Chromium Code Reviews| Index: content/renderer/media/user_media_client_impl.cc |
| diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc |
| index c490a1c36117ccfaf9168a8893e34afd7b1cad7d..f7ac3dd2521bf2a396658dfc8abb5008836ca015 100644 |
| --- a/content/renderer/media/user_media_client_impl.cc |
| +++ b/content/renderer/media/user_media_client_impl.cc |
| @@ -175,6 +175,29 @@ void CopyHotwordAndLocalEchoToStreamControls( |
| } |
| } |
| +bool CopyVideoKindToStreamControls( |
| + const blink::WebMediaConstraints& video_constraints, |
| + StreamControls* controls) { |
| + if (video_constraints.isNull()) |
| + return true; |
| + |
| + std::string video_kind_string; |
| + if (!GetConstraintValueAsString(video_constraints, |
| + &blink::WebMediaTrackConstraintSet::videoKind, |
| + &video_kind_string)) |
| + return true; |
| + if (video_kind_string == "color") { |
|
Guido Urdaneta
2017/02/07 10:26:04
nit: perhaps make the constants that were already
aleksandar.stojiljkovic
2017/02/07 11:33:49
Done.
|
| + controls->video_kind = VIDEO_KIND_COLOR; |
| + return true; |
| + } |
| + if (video_kind_string == "depth") { |
| + controls->video_kind = VIDEO_KIND_DEPTH; |
| + return true; |
| + } |
| + LOG(ERROR) << "Invalid videoKind value = " << video_kind_string; |
| + return false; |
| +} |
| + |
| bool IsSameDevice(const StreamDeviceInfo& device, |
| const StreamDeviceInfo& other_device) { |
| return device.device.id == other_device.device.id && |
| @@ -276,6 +299,12 @@ void UserMediaClientImpl::requestUserMedia( |
| CopyConstraintsToTrackControls(user_media_request.videoConstraints(), |
| &controls->video, |
| &request_video_input_devices); |
| + if (!CopyVideoKindToStreamControls(user_media_request.videoConstraints(), |
| + controls.get())) { |
| + GetUserMediaRequestFailed(user_media_request, MEDIA_DEVICE_NO_HARDWARE, |
| + ""); |
| + return; |
| + } |
| } |
| url::Origin security_origin = user_media_request.getSecurityOrigin(); |