OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |