1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "ppapi/shared_impl/media_stream_video_track_shared.h" 6 7#include "base/logging.h" 8 9namespace { 10 11const int32_t kMaxWidth = 4096; 12const int32_t kMaxHeight = 4096; 13 14} // namespace 15 16namespace ppapi { 17 18// static 19bool MediaStreamVideoTrackShared::VerifyAttributes( 20 const Attributes& attributes) { 21 if (attributes.buffers < 0) 22 return false; 23 if (attributes.format < PP_VIDEOFRAME_FORMAT_UNKNOWN || 24 attributes.format > PP_VIDEOFRAME_FORMAT_LAST) { 25 return false; 26 } 27 if (attributes.width < 0 || 28 attributes.width > kMaxWidth || 29 attributes.width & 0x3) { 30 return false; 31 } 32 if (attributes.height < 0 || 33 attributes.height > kMaxHeight || 34 attributes.height & 0x3) { 35 return false; 36 } 37 return true; 38} 39 40} // namespace ppapi 41