Chromium Code Reviews| OLD | NEW |
|---|---|
| (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; | |
|
yzshen1
2014/02/13 19:23:26
why 4069 but not 4096? :)
Peng
2014/02/13 21:28:34
oops! Done
| |
| 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) | |
|
yzshen1
2014/02/13 19:23:26
I think it should be <= 0 here, right?
Peng
2014/02/13 21:28:34
buffers == 0 means using default value.
yzshen1
2014/02/14 18:25:43
Do you mean the plugin can, say, first use Configu
Peng
2014/02/14 20:04:49
Yes. It provides a way to set an attribute back to
| |
| 23 return false; | |
| 24 } else if (attributes.buffers) { | |
|
yzshen1
2014/02/13 19:23:26
Please use explicit numeric check (here and below)
Peng
2014/02/13 21:28:34
Sorry. I don't understand this comment. Please rep
| |
| 25 return false; | |
| 26 } | |
| 27 | |
| 28 if (attributes.mask & Attributes::MASK_FORMAT) { | |
| 29 if (attributes.format < PP_VIDEOFRAME_FORMAT_UNKNOWN || | |
|
yzshen1
2014/02/13 19:23:26
maybe <=?
Peng
2014/02/13 21:28:34
Same, if format == PP_VIDEOFRAME_FORMAT_UNKNOWN, c
| |
| 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) | |
|
yzshen1
2014/02/13 19:23:26
Maybe <= 0?
Peng
2014/02/13 21:28:34
same. if width == 0, chrome will use the source vi
| |
| 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) | |
|
yzshen1
2014/02/13 19:23:26
Maybe <= 0?
Peng
2014/02/13 21:28:34
same to width.
| |
| 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 | |
| OLD | NEW |