Chromium Code Reviews| Index: content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| diff --git a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| index 199cdff7538a42aafd901257dae07a394a9e974a..0c5e1571f91b1111fda60941452d3d248dd3340b 100644 |
| --- a/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| +++ b/content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc |
| @@ -12,20 +12,25 @@ |
| namespace content { |
| -WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter(bool is_screencast) |
| - : is_screencast_(is_screencast), |
| +WebRtcVideoCapturerAdapter::WebRtcVideoCapturerAdapter( |
| + const scoped_refptr<base::MessageLoopProxy>& worker_thread_proxy, |
| + bool is_screencast) |
| + : worker_thread_proxy_(worker_thread_proxy), |
|
Ami GONE FROM CHROMIUM
2014/05/12 18:13:33
AFAICT worker_thread_proxy_ is only ever used to a
perkj_chrome
2014/05/12 19:28:26
yes- that would be cleaner I think, I used thread_
|
| + is_screencast_(is_screencast), |
| running_(false), |
| buffer_(NULL), |
| buffer_size_(0) { |
| } |
| WebRtcVideoCapturerAdapter::~WebRtcVideoCapturerAdapter() { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| DVLOG(3) << " WebRtcVideoCapturerAdapter::dtor"; |
| base::AlignedFree(buffer_); |
| } |
| cricket::CaptureState WebRtcVideoCapturerAdapter::Start( |
| const cricket::VideoFormat& capture_format) { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| DCHECK(!running_); |
| DVLOG(3) << " WebRtcVideoCapturerAdapter::Start w = " << capture_format.width |
| << " h = " << capture_format.height; |
| @@ -35,6 +40,7 @@ cricket::CaptureState WebRtcVideoCapturerAdapter::Start( |
| } |
| void WebRtcVideoCapturerAdapter::Stop() { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| DVLOG(3) << " WebRtcVideoCapturerAdapter::Stop "; |
| DCHECK(running_); |
| running_ = false; |
| @@ -43,11 +49,13 @@ void WebRtcVideoCapturerAdapter::Stop() { |
| } |
| bool WebRtcVideoCapturerAdapter::IsRunning() { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| return running_; |
| } |
| bool WebRtcVideoCapturerAdapter::GetPreferredFourccs( |
| std::vector<uint32>* fourccs) { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| if (!fourccs) |
| return false; |
| fourccs->push_back(cricket::FOURCC_I420); |
| @@ -61,6 +69,7 @@ bool WebRtcVideoCapturerAdapter::IsScreencast() const { |
| bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat( |
| const cricket::VideoFormat& desired, |
| cricket::VideoFormat* best_format) { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| DVLOG(3) << " GetBestCaptureFormat:: " |
| << " w = " << desired.width |
| << " h = " << desired.height; |
| @@ -77,6 +86,7 @@ bool WebRtcVideoCapturerAdapter::GetBestCaptureFormat( |
| void WebRtcVideoCapturerAdapter::OnFrameCaptured( |
| const scoped_refptr<media::VideoFrame>& frame) { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| DCHECK(media::VideoFrame::I420 == frame->format() || |
| media::VideoFrame::YV12 == frame->format()); |
| if (first_frame_timestamp_ == media::kNoTimestamp()) |
| @@ -120,6 +130,7 @@ void WebRtcVideoCapturerAdapter::OnFrameCaptured( |
| void WebRtcVideoCapturerAdapter::UpdateI420Buffer( |
| const scoped_refptr<media::VideoFrame>& src) { |
| + DCHECK(worker_thread_proxy_->BelongsToCurrentThread()); |
| const int src_width = src->coded_size().width(); |
| const int src_height = src->coded_size().height(); |
| const int dst_width = src->visible_rect().width(); |