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

Side by Side Diff: content/renderer/media/rtc_video_capture_delegate.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: Fix 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
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/rtc_video_capture_delegate.h" 5 #include "content/renderer/media/rtc_video_capture_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 8
9 namespace content { 9 namespace content {
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 void RtcVideoCaptureDelegate::OnStopped(media::VideoCapture* capture) { 53 void RtcVideoCaptureDelegate::OnStopped(media::VideoCapture* capture) {
54 } 54 }
55 55
56 void RtcVideoCaptureDelegate::OnPaused(media::VideoCapture* capture) { 56 void RtcVideoCaptureDelegate::OnPaused(media::VideoCapture* capture) {
57 NOTIMPLEMENTED(); 57 NOTIMPLEMENTED();
58 } 58 }
59 59
60 void RtcVideoCaptureDelegate::OnError(media::VideoCapture* capture, 60 void RtcVideoCaptureDelegate::OnError(media::VideoCapture* capture,
61 int error_code) { 61 int error_code) {
62 message_loop_proxy_->PostTask(
63 FROM_HERE,
64 base::Bind(&RtcVideoCaptureDelegate::OnErrorOnCaptureThread,
65 this, capture, error_code));
66 } 62 }
67 63
68 void RtcVideoCaptureDelegate::OnRemoved(media::VideoCapture* capture) { 64 void RtcVideoCaptureDelegate::OnRemoved(media::VideoCapture* capture) {
69 DVLOG(3) << " RtcVideoCaptureDelegate::OnRemoved"; 65 DVLOG(3) << " RtcVideoCaptureDelegate::OnRemoved";
66 message_loop_proxy_->PostTask(
67 FROM_HERE,
68 base::Bind(&RtcVideoCaptureDelegate::OnRemovedOnCaptureThread,
69 this, capture));
70
70 // Balance the AddRef in StartCapture. 71 // Balance the AddRef in StartCapture.
71 // This means we are no longer registered as an event handler and can safely 72 // This means we are no longer registered as an event handler and can safely
72 // be deleted. 73 // be deleted.
73 Release(); 74 Release();
74 } 75 }
75 76
76 void RtcVideoCaptureDelegate::OnBufferReady( 77 void RtcVideoCaptureDelegate::OnBufferReady(
77 media::VideoCapture* capture, 78 media::VideoCapture* capture,
78 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { 79 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) {
79 message_loop_proxy_->PostTask( 80 message_loop_proxy_->PostTask(
(...skipping 16 matching lines...) Expand all
96 got_first_frame_ = true; 97 got_first_frame_ = true;
97 if (!state_callback_.is_null()) 98 if (!state_callback_.is_null())
98 state_callback_.Run(CAPTURE_RUNNING); 99 state_callback_.Run(CAPTURE_RUNNING);
99 } 100 }
100 101
101 captured_callback_.Run(*buf); 102 captured_callback_.Run(*buf);
102 } 103 }
103 capture->FeedBuffer(buf); 104 capture->FeedBuffer(buf);
104 } 105 }
105 106
106 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread( 107 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread(
107 media::VideoCapture* capture, int error_code) { 108 media::VideoCapture* capture) {
108 if (!state_callback_.is_null()) 109 if (!state_callback_.is_null())
109 state_callback_.Run(got_first_frame_ ? CAPTURE_STOPPED : CAPTURE_FAILED); 110 state_callback_.Run(got_first_frame_ ? CAPTURE_STOPPED : CAPTURE_FAILED);
wjia(left Chromium) 2013/04/05 18:39:17 This could still have problem since OnRemoved is c
perkj_chrome 2013/04/08 11:15:54 Do you know why we have have got_first_frame_ ? Wh
110 } 111 }
111 112
112 } // namespace content 113 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_capture_delegate.h ('k') | content/renderer/media/rtc_video_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698