Revert 285458 "Disable exceptions on Windows in all builds (take 3)"
[chromium-blink-merge.git] / ppapi / shared_impl / media_stream_video_track_shared.cc
blob0ca894af62c2191ad5eca3827ca4a984e2b35807
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.
5 #include "ppapi/shared_impl/media_stream_video_track_shared.h"
7 #include "base/logging.h"
9 namespace {
11 const int32_t kMaxWidth = 4096;
12 const int32_t kMaxHeight = 4096;
14 } // namespace
16 namespace ppapi {
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;
27 if (attributes.width < 0 ||
28 attributes.width > kMaxWidth ||
29 attributes.width & 0x3) {
30 return false;
32 if (attributes.height < 0 ||
33 attributes.height > kMaxHeight ||
34 attributes.height & 0x3) {
35 return false;
37 return true;
40 } // namespace ppapi