Chromium Code Reviews| Index: content/renderer/media/media_stream_video_source.cc |
| diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc |
| index 759e6213960d07c8daf12bacb0245514a773d069..f5513d56272506064ddd52a8408a9fcf52de3684 100644 |
| --- a/content/renderer/media/media_stream_video_source.cc |
| +++ b/content/renderer/media/media_stream_video_source.cc |
| @@ -15,6 +15,9 @@ |
| #include "content/child/child_process.h" |
| #include "content/renderer/media/media_stream_video_track.h" |
| #include "content/renderer/media/video_track_adapter.h" |
| +#include "third_party/WebKit/public/platform/WebString.h" |
| + |
| +using blink::WebString; |
| namespace content { |
| @@ -28,7 +31,17 @@ const char* const kLegalVideoConstraints[] = {"width", |
| "deviceId", |
| "groupId", |
| "mediaStreamSource", |
| - "googNoiseReduction"}; |
| + "googNoiseReduction", |
| + "videoKind"}; |
| + |
| +const char kVideoKindDepth[] = "depth"; |
|
Guido Urdaneta
2017/02/07 10:26:04
This constant is also defined elsewhere and litera
aleksandar.stojiljkovic
2017/02/07 11:33:49
Done - media_stream_options.h
aleksandar.stojiljkovic
2017/02/09 21:39:25
Moved to media_stream_video_track.h as it is used
|
| +const char kVideoKindColor[] = "color"; |
| +// Returns videoKind value for |format|. |
| +WebString getVideoKindForFormat(const media::VideoCaptureFormat& format) { |
| + return (format.pixel_format == media::PIXEL_FORMAT_Y16) |
| + ? WebString::fromUTF8(kVideoKindDepth) |
| + : WebString::fromUTF8(kVideoKindColor); |
|
kinuko
2017/02/07 04:55:49
nit: fromASCII() would be enough as they're both a
aleksandar.stojiljkovic
2017/02/07 11:33:49
Done.
|
| +} |
| // Returns true if |constraint| has mandatory constraints. |
| bool HasMandatoryConstraints(const blink::WebMediaConstraints& constraints) { |
| @@ -142,6 +155,9 @@ bool UpdateFormatForConstraints( |
| (constraints.height.hasExact() && |
| constraints.height.exact() > format->frame_size.height())) { |
| *failing_constraint_name = constraints.height.name(); |
| + } else if (constraints.videoKind.hasExact() && |
| + !constraints.videoKind.matches(getVideoKindForFormat(*format))) { |
| + *failing_constraint_name = constraints.videoKind.name(); |
| } else if (!constraints.frameRate.matches(format->frame_rate)) { |
| if (constraints.frameRate.hasMax()) { |
| const double value = constraints.frameRate.max(); |