| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread( | 100 void RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread( |
| 101 media::VideoCapture* capture, | 101 media::VideoCapture* capture, |
| 102 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { | 102 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { |
| 103 if (!captured_callback_.is_null()) { | 103 if (!captured_callback_.is_null()) { |
| 104 if (!got_first_frame_) { | 104 if (!got_first_frame_) { |
| 105 got_first_frame_ = true; | 105 got_first_frame_ = true; |
| 106 if (!state_callback_.is_null()) | 106 if (!state_callback_.is_null()) |
| 107 state_callback_.Run(CAPTURE_RUNNING); | 107 state_callback_.Run(CAPTURE_RUNNING); |
| 108 } | 108 } |
| 109 | 109 |
| 110 captured_callback_.Run(*buf); | 110 captured_callback_.Run(*buf.get()); |
| 111 } | 111 } |
| 112 capture->FeedBuffer(buf); | 112 capture->FeedBuffer(buf); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread( | 115 void RtcVideoCaptureDelegate::OnErrorOnCaptureThread( |
| 116 media::VideoCapture* capture) { | 116 media::VideoCapture* capture) { |
| 117 error_occured_ = true; | 117 error_occured_ = true; |
| 118 if (!state_callback_.is_null()) | 118 if (!state_callback_.is_null()) |
| 119 state_callback_.Run(CAPTURE_FAILED); | 119 state_callback_.Run(CAPTURE_FAILED); |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread( | 123 void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread( |
| 124 media::VideoCapture* capture) { | 124 media::VideoCapture* capture) { |
| 125 if (!error_occured_ && !state_callback_.is_null()) | 125 if (!error_occured_ && !state_callback_.is_null()) |
| 126 state_callback_.Run(CAPTURE_STOPPED); | 126 state_callback_.Run(CAPTURE_STOPPED); |
| 127 } | 127 } |
| 128 | 128 |
| 129 } // namespace content | 129 } // namespace content |
| OLD | NEW |