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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/shared_impl/media_stream_video_track_shared.cc
diff --git a/ppapi/shared_impl/media_stream_video_track_shared.cc b/ppapi/shared_impl/media_stream_video_track_shared.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7e16c680e3228aa7898c6e19e1d416dd9cec623f
--- /dev/null
+++ b/ppapi/shared_impl/media_stream_video_track_shared.cc
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/shared_impl/media_stream_video_track_shared.h"
+
+#include "base/logging.h"
+
+namespace {
+
+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
+const int32_t kMaxHeight = 4069;
+
+} // namespace
+
+namespace ppapi {
+
+// static
+bool MediaStreamVideoTrackShared::VerifyAttributes(
+ const Attributes& attributes) {
+ if (attributes.mask & Attributes::MASK_BUFFERS) {
+ 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
+ return false;
+ } 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
+ return false;
+ }
+
+ if (attributes.mask & Attributes::MASK_FORMAT) {
+ 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
+ attributes.format > PP_VIDEOFRAME_FORMAT_LAST) {
+ return false;
+ }
+ } else if (attributes.format) {
+ return false;
+ }
+
+ if (attributes.mask & Attributes::MASK_WIDTH) {
+ 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
+ return false;
+ if (attributes.width & 0x3)
+ return false;
+ } else if (attributes.width) {
+ return false;
+ }
+
+ if (attributes.mask & Attributes::MASK_HEIGHT) {
+ 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.
+ return false;
+ if (attributes.height & 0x3)
+ return false;
+ } else if (attributes.height) {
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace ppapi
« ppapi/proxy/ppapi_param_traits.cc ('K') | « ppapi/shared_impl/media_stream_video_track_shared.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698