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

Side by Side Diff: content/renderer/media/user_media_client_impl.cc

Issue 1806303002: Copy device IDs from advanced constraints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/user_media_client_impl.h" 5 #include "content/renderer/media/user_media_client_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 void CopyBlinkRequestToStreamControls(const blink::WebUserMediaRequest& request, 58 void CopyBlinkRequestToStreamControls(const blink::WebUserMediaRequest& request,
59 StreamControls* controls) { 59 StreamControls* controls) {
60 if (request.isNull()) { 60 if (request.isNull()) {
61 return; 61 return;
62 } 62 }
63 if (!request.audioConstraints().isNull()) { 63 if (!request.audioConstraints().isNull()) {
64 const blink::WebMediaTrackConstraintSet& audio_basic = 64 const blink::WebMediaTrackConstraintSet& audio_basic =
65 request.audioConstraints().basic(); 65 request.audioConstraints().basic();
66 CopyFirstString(audio_basic.mediaStreamSource.exact(), 66 CopyFirstString(audio_basic.mediaStreamSource.exact(),
67 &(controls->audio.stream_source)); 67 &controls->audio.stream_source);
68 CopyVector(audio_basic.deviceId.exact(), &(controls->audio.device_ids)); 68 CopyVector(audio_basic.deviceId.exact(), &(controls->audio.device_ids));
69 // Optionals. They may be either in ideal or in advanced.exact. 69 // Optionals. They may be either in ideal or in advanced.exact.
70 // TODO(hta): Get alternatives only mentioned in advanced array.
71 CopyVector(audio_basic.deviceId.ideal(), 70 CopyVector(audio_basic.deviceId.ideal(),
72 &controls->audio.alternate_device_ids); 71 &controls->audio.alternate_device_ids);
73 72 for (const auto& constraint : request.audioConstraints().advanced()) {
73 CopyVector(constraint.deviceId.exact(),
74 &controls->audio.alternate_device_ids);
75 CopyVector(constraint.deviceId.ideal(),
76 &controls->audio.alternate_device_ids);
77 }
74 if (audio_basic.hotwordEnabled.hasExact()) { 78 if (audio_basic.hotwordEnabled.hasExact()) {
75 controls->hotword_enabled = audio_basic.hotwordEnabled.exact(); 79 controls->hotword_enabled = audio_basic.hotwordEnabled.exact();
76 } else { 80 } else {
77 for (const auto& audio_advanced : request.audioConstraints().advanced()) { 81 for (const auto& audio_advanced : request.audioConstraints().advanced()) {
78 if (audio_advanced.hotwordEnabled.hasExact()) { 82 if (audio_advanced.hotwordEnabled.hasExact()) {
79 controls->hotword_enabled = audio_advanced.hotwordEnabled.exact(); 83 controls->hotword_enabled = audio_advanced.hotwordEnabled.exact();
80 break; 84 break;
81 } 85 }
82 } 86 }
83 } 87 }
84 } 88 }
85 if (!request.videoConstraints().isNull()) { 89 if (!request.videoConstraints().isNull()) {
86 const blink::WebMediaTrackConstraintSet& video_basic = 90 const blink::WebMediaTrackConstraintSet& video_basic =
87 request.videoConstraints().basic(); 91 request.videoConstraints().basic();
88 CopyFirstString(video_basic.mediaStreamSource.exact(), 92 CopyFirstString(video_basic.mediaStreamSource.exact(),
89 &(controls->video.stream_source)); 93 &(controls->video.stream_source));
90 CopyVector(video_basic.deviceId.exact(), &(controls->video.device_ids)); 94 CopyVector(video_basic.deviceId.exact(), &(controls->video.device_ids));
91 CopyVector(video_basic.deviceId.ideal(), 95 CopyVector(video_basic.deviceId.ideal(),
92 &(controls->video.alternate_device_ids)); 96 &(controls->video.alternate_device_ids));
97 for (const auto& constraint : request.videoConstraints().advanced()) {
98 CopyVector(constraint.deviceId.exact(),
99 &controls->video.alternate_device_ids);
100 CopyVector(constraint.deviceId.ideal(),
101 &controls->video.alternate_device_ids);
102 }
93 } 103 }
94 } 104 }
95 105
96 static int g_next_request_id = 0; 106 static int g_next_request_id = 0;
97 107
98 } // namespace 108 } // namespace
99 109
100 struct UserMediaClientImpl::MediaDevicesRequestInfo { 110 struct UserMediaClientImpl::MediaDevicesRequestInfo {
101 MediaDevicesRequestInfo(const blink::WebMediaDevicesRequest& request, 111 MediaDevicesRequestInfo(const blink::WebMediaDevicesRequest& request,
102 int audio_input_request_id, 112 int audio_input_request_id,
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 return; 1145 return;
1136 } 1146 }
1137 } 1147 }
1138 } 1148 }
1139 1149
1140 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { 1150 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const {
1141 return !sources_waiting_for_callback_.empty(); 1151 return !sources_waiting_for_callback_.empty();
1142 } 1152 }
1143 1153
1144 } // namespace content 1154 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698