Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Side by Side Diff: ppapi/shared_impl/media_stream_video_track_shared.cc

Issue 150403006: [PPAPI][MediaStream] Support configure for video input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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 = 4069;
12 const int32_t kMaxHeight = 4069;
13
14 } // namespace
15
16 namespace ppapi {
17
18 // static
19 bool MediaStreamVideoTrackShared::VerifyAttributes(
20 const Attributes& attributes) {
21 if (attributes.mask & Attributes::MASK_BUFFERS) {
22 if (attributes.buffers < 0)
23 return false;
24 } else if (attributes.buffers) {
Ronghua Wu (Left Chromium) 2014/02/12 19:54:15 can the value 0 means not set instead of using an
Peng 2014/02/13 17:19:11 My idea is: If the mask is 1 and value is 0. it m
25 return false;
26 }
27
28 if (attributes.mask & Attributes::MASK_FORMAT) {
29 if (attributes.format < PP_VIDEOFRAME_FORMAT_UNKNOWN ||
30 attributes.format > PP_VIDEOFRAME_FORMAT_LAST) {
31 return false;
32 }
33 } else if (attributes.format) {
34 return false;
35 }
36
37 if (attributes.mask & Attributes::MASK_WIDTH) {
38 if (attributes.width < 0 || attributes.width > kMaxWidth)
39 return false;
40 if (attributes.width & 0x3)
41 return false;
42 } else if (attributes.width) {
43 return false;
44 }
45
46 if (attributes.mask & Attributes::MASK_HEIGHT) {
47 if (attributes.height < 0 || attributes.height > kMaxHeight)
48 return false;
49 if (attributes.height & 0x3)
50 return false;
51 } else if (attributes.height) {
52 return false;
53 }
54
55 return true;
56 }
57
58 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698