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

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

Issue 10391065: handle the case when device is closed before media pipeline is fully initialized. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: code review 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 unified diff | Download patch | Annotate | Revision Log
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/video_capture_controller.h" 5 #include "content/browser/renderer_host/media/video_capture_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/media/media_stream_manager.h" 10 #include "content/browser/renderer_host/media/media_stream_manager.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 void VideoCaptureController::StopSession( 209 void VideoCaptureController::StopSession(
210 int session_id) { 210 int session_id) {
211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
212 DVLOG(1) << "VideoCaptureController::StopSession, id " << session_id; 212 DVLOG(1) << "VideoCaptureController::StopSession, id " << session_id;
213 213
214 ControllerClient* client = FindClient(session_id, pending_clients_); 214 ControllerClient* client = FindClient(session_id, pending_clients_);
215 if (!client) 215 if (!client)
216 client = FindClient(session_id, controller_clients_); 216 client = FindClient(session_id, controller_clients_);
217 217
218 if (client) 218 if (client) {
219 client->session_closed = true; 219 client->session_closed = true;
220 client->event_handler->OnPaused(client->controller_id);
221 }
220 } 222 }
221 223
222 void VideoCaptureController::ReturnBuffer( 224 void VideoCaptureController::ReturnBuffer(
223 const VideoCaptureControllerID& id, 225 const VideoCaptureControllerID& id,
224 VideoCaptureControllerEventHandler* event_handler, 226 VideoCaptureControllerEventHandler* event_handler,
225 int buffer_id) { 227 int buffer_id) {
226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
227 229
228 ControllerClient* client = FindClient(id, event_handler, 230 ControllerClient* client = FindClient(id, event_handler,
229 controller_clients_); 231 controller_clients_);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 bool VideoCaptureController::ClientHasDIB() { 582 bool VideoCaptureController::ClientHasDIB() {
581 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
582 base::AutoLock lock(lock_); 584 base::AutoLock lock(lock_);
583 for (DIBMap::iterator dib_it = owned_dibs_.begin(); 585 for (DIBMap::iterator dib_it = owned_dibs_.begin();
584 dib_it != owned_dibs_.end(); dib_it++) { 586 dib_it != owned_dibs_.end(); dib_it++) {
585 if (dib_it->second->references > 0) 587 if (dib_it->second->references > 0)
586 return true; 588 return true;
587 } 589 }
588 return false; 590 return false;
589 } 591 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698