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

Unified Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 10534004: Implement CancelUserMediaRequest for the browser part (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed tommi's comments Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/media_stream_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index ca2d285041f88865e24470dc3ccf408c76d8744b..be921202e3646de81587f87f60dedb4d66359c16 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -214,6 +214,42 @@ void MediaStreamManager::CancelRequests(MediaStreamRequester* requester) {
}
}
+void MediaStreamManager::CancelGenerateStream(const std::string& label) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ DeviceRequests::iterator it = requests_.find(label);
+ if (it != requests_.end()) {
+ // The request isn't complete.
+ if (!RequestDone(it->second)) {
+ DeviceRequest* request = &(it->second);
+ if (request->state[content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE] ==
+ DeviceRequest::kOpening) {
+ for (StreamDeviceInfoArray::iterator it =
+ request->audio_devices.begin(); it != request->audio_devices.end();
+ ++it) {
+ if (it->in_use) {
wjia(left Chromium) 2012/06/06 13:40:24 This check is not needed. |in_use| is a signal for
+ audio_input_device_manager()->Close(it->session_id);
+ }
+ }
+ }
+ if (request->state[content::MEDIA_STREAM_DEVICE_TYPE_VIDEO_CAPTURE] ==
+ DeviceRequest::kOpening) {
+ for (StreamDeviceInfoArray::iterator it =
+ request->video_devices.begin(); it != request->video_devices.end();
+ ++it) {
+ if (it->in_use) {
wjia(left Chromium) 2012/06/06 13:40:24 ditto.
+ video_capture_manager()->Close(it->session_id);
+ }
+ }
+ }
+ requests_.erase(it);
+ } else {
+ StopGeneratedStream(label);
+ }
+ device_settings_->RemovePendingCaptureRequest(label);
+ }
+}
+
void MediaStreamManager::StopGeneratedStream(const std::string& label) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Find the request and close all open devices for the request.
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | content/renderer/media/media_stream_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698