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

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

Issue 2721113002: getUserMedia: handle the device starting status report. (Closed)
Patch Set: address nits Created 3 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
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_manager.h" 5 #include "content/browser/renderer_host/media/media_stream_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 1331
1332 void MediaStreamManager::HandleRequestDone(const std::string& label, 1332 void MediaStreamManager::HandleRequestDone(const std::string& label,
1333 DeviceRequest* request) { 1333 DeviceRequest* request) {
1334 DCHECK(RequestDone(*request)); 1334 DCHECK(RequestDone(*request));
1335 DVLOG(1) << "HandleRequestDone(" 1335 DVLOG(1) << "HandleRequestDone("
1336 << ", {label = " << label << "})"; 1336 << ", {label = " << label << "})";
1337 1337
1338 switch (request->request_type) { 1338 switch (request->request_type) {
1339 case MEDIA_OPEN_DEVICE_PEPPER_ONLY: 1339 case MEDIA_OPEN_DEVICE_PEPPER_ONLY:
1340 FinalizeOpenDevice(label, request); 1340 FinalizeOpenDevice(label, request);
1341 OnStreamStarted(label);
1341 break; 1342 break;
1342 case MEDIA_GENERATE_STREAM: { 1343 case MEDIA_GENERATE_STREAM: {
1343 FinalizeGenerateStream(label, request); 1344 FinalizeGenerateStream(label, request);
1344 break; 1345 break;
1345 } 1346 }
1346 default: 1347 default:
1347 NOTREACHED(); 1348 NOTREACHED();
1348 break; 1349 break;
1349 } 1350 }
1350
1351 if (request->ui_proxy.get()) {
1352 request->ui_proxy->OnStarted(
1353 base::Bind(&MediaStreamManager::StopMediaStreamFromBrowser,
1354 base::Unretained(this),
1355 label),
1356 base::Bind(&MediaStreamManager::OnMediaStreamUIWindowId,
1357 base::Unretained(this),
1358 request->video_type(),
1359 request->devices));
1360 }
1361 } 1351 }
1362 1352
1363 void MediaStreamManager::Closed(MediaStreamType stream_type, 1353 void MediaStreamManager::Closed(MediaStreamType stream_type,
1364 int capture_session_id) { 1354 int capture_session_id) {
1365 DCHECK_CURRENTLY_ON(BrowserThread::IO); 1355 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1366 } 1356 }
1367 1357
1368 void MediaStreamManager::DevicesEnumerated( 1358 void MediaStreamManager::DevicesEnumerated(
1369 bool requested_audio_input, 1359 bool requested_audio_input,
1370 bool requested_video_input, 1360 bool requested_video_input,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 if (stream_type != MEDIA_DEVICE_VIDEO_CAPTURE) 1757 if (stream_type != MEDIA_DEVICE_VIDEO_CAPTURE)
1768 return devices; 1758 return devices;
1769 1759
1770 for (auto& device : devices) { 1760 for (auto& device : devices) {
1771 device.camera_calibration = 1761 device.camera_calibration =
1772 video_capture_manager()->GetCameraCalibration(device.id); 1762 video_capture_manager()->GetCameraCalibration(device.id);
1773 } 1763 }
1774 return devices; 1764 return devices;
1775 } 1765 }
1776 1766
1767 void MediaStreamManager::OnStreamStarted(const std::string& label) {
1768 DeviceRequest* const request = FindRequest(label);
1769 if (!request)
1770 return;
1771
1772 if (request->ui_proxy) {
1773 request->ui_proxy->OnStarted(
1774 base::Bind(&MediaStreamManager::StopMediaStreamFromBrowser,
1775 base::Unretained(this), label),
1776 base::Bind(&MediaStreamManager::OnMediaStreamUIWindowId,
1777 base::Unretained(this), request->video_type(),
1778 request->devices));
1779 }
1780 }
1781
1777 } // namespace content 1782 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698