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

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

Issue 13616004: Switch event type when a capture device has been stopped from the render process. This make sure th… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed code review comments. Created 7 years, 8 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
« no previous file with comments | « content/renderer/media/rtc_video_capturer.cc ('k') | 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/video_capture_impl.h" 5 #include "content/renderer/media/video_capture_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/common/child_process.h" 9 #include "content/common/child_process.h"
10 #include "content/common/media/video_capture_messages.h" 10 #include "content/common/media/video_capture_messages.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 DVLOG(1) << "OnStateChanged: error!, device_id = " << device_id_; 314 DVLOG(1) << "OnStateChanged: error!, device_id = " << device_id_;
315 for (ClientInfo::iterator it = clients_.begin(); 315 for (ClientInfo::iterator it = clients_.begin();
316 it != clients_.end(); ++it) { 316 it != clients_.end(); ++it) {
317 // TODO(wjia): browser process would send error code. 317 // TODO(wjia): browser process would send error code.
318 it->first->OnError(this, 1); 318 it->first->OnError(this, 1);
319 it->first->OnRemoved(this); 319 it->first->OnRemoved(this);
320 } 320 }
321 clients_.clear(); 321 clients_.clear();
322 state_ = VIDEO_CAPTURE_STATE_ERROR; 322 state_ = VIDEO_CAPTURE_STATE_ERROR;
323 break; 323 break;
324 case VIDEO_CAPTURE_STATE_ENDED:
325 DVLOG(1) << "OnStateChanged: ended!, device_id = " << device_id_;
326 STLDeleteValues(&cached_dibs_);
327 for (ClientInfo::iterator it = clients_.begin();
328 it != clients_.end(); ++it) {
329 it->first->OnRemoved(this);
330 }
331 clients_.clear();
332 state_ = VIDEO_CAPTURE_STATE_ENDED;
333 break;
324 default: 334 default:
325 break; 335 break;
326 } 336 }
327 } 337 }
328 338
329 void VideoCaptureImpl::DoDeviceInfoReceivedOnCaptureThread( 339 void VideoCaptureImpl::DoDeviceInfoReceivedOnCaptureThread(
330 const media::VideoCaptureParams& device_info) { 340 const media::VideoCaptureParams& device_info) {
331 DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); 341 DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread());
332 DCHECK(!ClientHasDIB()); 342 DCHECK(!ClientHasDIB());
333 343
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 if (it != clients->end()) { 445 if (it != clients->end()) {
436 handler->OnStopped(this); 446 handler->OnStopped(this);
437 handler->OnRemoved(this); 447 handler->OnRemoved(this);
438 clients->erase(it); 448 clients->erase(it);
439 found = true; 449 found = true;
440 } 450 }
441 return found; 451 return found;
442 } 452 }
443 453
444 } // namespace content 454 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_capturer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698