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

Side by Side Diff: content/browser/renderer_host/media/media_stream_device_settings.cc

Issue 10177008: Shift media_stream::StreamOptions to align with the new getUserMedia spec (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 years, 7 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 | content/browser/renderer_host/media/media_stream_dispatcher_host.cc » ('j') | 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/browser/renderer_host/media/media_stream_device_settings.h" 5 #include "content/browser/renderer_host/media/media_stream_device_settings.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 MediaStreamDeviceSettingsRequest* request = request_it->second; 146 MediaStreamDeviceSettingsRequest* request = request_it->second;
147 DCHECK_EQ(request->devices_full.count(stream_type), static_cast<size_t>(0)) << 147 DCHECK_EQ(request->devices_full.count(stream_type), static_cast<size_t>(0)) <<
148 "This request already has a list of devices for this stream type."; 148 "This request already has a list of devices for this stream type.";
149 request->devices_full[stream_type] = devices; 149 request->devices_full[stream_type] = devices;
150 150
151 // Check if we're done. 151 // Check if we're done.
152 size_t num_media_requests = 0; 152 size_t num_media_requests = 0;
153 if (request->options.audio) { 153 if (request->options.audio) {
154 num_media_requests++; 154 num_media_requests++;
155 } 155 }
156 if (request->options.video_option != StreamOptions::kNoCamera) { 156 if (request->options.video) {
157 num_media_requests++; 157 num_media_requests++;
158 } 158 }
159 159
160 if (request->devices_full.size() == num_media_requests) { 160 if (request->devices_full.size() == num_media_requests) {
161 // We have all answers needed. 161 // We have all answers needed.
162 if (!use_fake_ui_) { 162 if (!use_fake_ui_) {
163 // Abort if the task was already posted: wait for it to PostResponse. 163 // Abort if the task was already posted: wait for it to PostResponse.
164 if (request->posted_task) { 164 if (request->posted_task) {
165 return; 165 return;
166 } 166 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 it->second->render_view_id == render_view_id) { 270 it->second->render_view_id == render_view_id) {
271 // This request belongs to the given render view. 271 // This request belongs to the given render view.
272 MediaStreamDeviceSettingsRequest* request = it->second; 272 MediaStreamDeviceSettingsRequest* request = it->second;
273 if (request->options.audio && 273 if (request->options.audio &&
274 request->devices_full[ 274 request->devices_full[
275 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE].empty()) { 275 content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE].empty()) {
276 // Audio requested, but no devices enumerated yet. Continue to next 276 // Audio requested, but no devices enumerated yet. Continue to next
277 // request. 277 // request.
278 continue; 278 continue;
279 } 279 }
280 if (request->options.video_option != StreamOptions::kNoCamera && 280 if (request->options.video &&
281 request->devices_full[ 281 request->devices_full[
282 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE].empty()) { 282 content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE].empty()) {
283 // Video requested, but no devices enumerated yet. Continue to next 283 // Video requested, but no devices enumerated yet. Continue to next
284 // request. 284 // request.
285 continue; 285 continue;
286 } 286 }
287 // This request belongs to the same view as the treated request and is 287 // This request belongs to the same view as the treated request and is
288 // ready to be requested. Return its label. 288 // ready to be requested. Return its label.
289 return it->first; 289 return it->first;
290 } 290 }
(...skipping 27 matching lines...) Expand all
318 BrowserThread::PostTask( 318 BrowserThread::PostTask(
319 BrowserThread::UI, FROM_HERE, 319 BrowserThread::UI, FROM_HERE,
320 base::Bind( 320 base::Bind(
321 &content::ContentBrowserClient::RequestMediaAccessPermission, 321 &content::ContentBrowserClient::RequestMediaAccessPermission,
322 base::Unretained(content::GetContentClient()->browser()), 322 base::Unretained(content::GetContentClient()->browser()),
323 request, callback)); 323 request, callback));
324 324
325 } 325 }
326 326
327 } // namespace media_stream 327 } // namespace media_stream
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698