Home | History | Annotate | Download | only in shared_impl
      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 
      9 namespace {
     10 
     11 const int32_t kMaxWidth = 4096;
     12 const int32_t kMaxHeight = 4096;
     13 
     14 }  // namespace
     15 
     16 namespace ppapi {
     17 
     18 // static
     19 bool 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