From 1f29be6be1b2671cc73cd8f83045b7e4a208216b Mon Sep 17 00:00:00 2001 From: perkj Date: Thu, 24 Mar 2016 01:24:52 -0700 Subject: Remove use of deprecated methods to cricket::VideoCapturer in WebrtcVideoCapturerAdapter VideoCapturer::Pause is never used in the webrtc code base. SignalgVideoFrame should also be removed and replaced with normal method call to VideoCapturer::OnFrame. BUG=webrtc:5426 Review URL: https://codereview.chromium.org/1745923002 Cr-Commit-Position: refs/heads/master@{#383040} --- remoting/protocol/webrtc_video_capturer_adapter.cc | 20 ++++++-------------- remoting/protocol/webrtc_video_capturer_adapter.h | 3 ++- remoting/protocol/webrtc_video_stream.cc | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) (limited to 'remoting/protocol') diff --git a/remoting/protocol/webrtc_video_capturer_adapter.cc b/remoting/protocol/webrtc_video_capturer_adapter.cc index c0aeea1..0511a8f 100644 --- a/remoting/protocol/webrtc_video_capturer_adapter.cc +++ b/remoting/protocol/webrtc_video_capturer_adapter.cc @@ -71,16 +71,11 @@ cricket::CaptureState WebrtcVideoCapturerAdapter::Start( return cricket::CS_RUNNING; } -// Similar to the base class implementation with some important differences: -// 1. Does not call either Stop() or Start(), as those would affect the state of -// |desktop_capturer_|. -// 2. Does not support unpausing after stopping the capturer. It is unclear -// if that flow needs to be supported. -bool WebrtcVideoCapturerAdapter::Pause(bool pause) { +bool WebrtcVideoCapturerAdapter::PauseCapturer(bool pause) { DCHECK(thread_checker_.CalledOnValidThread()); if (pause) { - if (capture_state() == cricket::CS_PAUSED) + if (paused_) return true; bool running = capture_state() == cricket::CS_STARTING || @@ -94,28 +89,25 @@ bool WebrtcVideoCapturerAdapter::Pause(bool pause) { return false; } - // Stop |capture_timer_| and set capture state to cricket::CS_PAUSED. capture_timer_->Stop(); - SetCaptureState(cricket::CS_PAUSED); + paused_ = true; VLOG(1) << "WebrtcVideoCapturerAdapter paused."; return true; } else { // Unpausing. - if (capture_state() != cricket::CS_PAUSED || !GetCaptureFormat() || - !capture_timer_) { + if (!paused_ || !GetCaptureFormat() || !capture_timer_) { LOG(ERROR) << "Cannot unpause WebrtcVideoCapturerAdapter."; return false; } - // Restart |capture_timer_| and set capture state to cricket::CS_RUNNING; capture_timer_->Start(FROM_HERE, base::TimeDelta::FromMicroseconds( GetCaptureFormat()->interval / (base::Time::kNanosecondsPerMicrosecond)), this, &WebrtcVideoCapturerAdapter::CaptureNextFrame); - SetCaptureState(cricket::CS_RUNNING); + paused_ = false; VLOG(1) << "WebrtcVideoCapturerAdapter unpaused."; } @@ -223,7 +215,7 @@ void WebrtcVideoCapturerAdapter::OnCaptureCompleted( yuv_frame_->GetVPitch(), width, height); } - SignalVideoFrame(this, yuv_frame_.get()); + OnFrame(this, yuv_frame_.get()); } void WebrtcVideoCapturerAdapter::CaptureNextFrame() { diff --git a/remoting/protocol/webrtc_video_capturer_adapter.h b/remoting/protocol/webrtc_video_capturer_adapter.h index add16036..e13c06b 100644 --- a/remoting/protocol/webrtc_video_capturer_adapter.h +++ b/remoting/protocol/webrtc_video_capturer_adapter.h @@ -50,6 +50,7 @@ class WebrtcVideoCapturerAdapter : public cricket::VideoCapturer, ~WebrtcVideoCapturerAdapter() override; void SetSizeCallback(const SizeCallback& size_callback); + bool PauseCapturer(bool pause); base::WeakPtr GetWeakPtr(); // cricket::VideoCapturer implementation. @@ -57,7 +58,6 @@ class WebrtcVideoCapturerAdapter : public cricket::VideoCapturer, cricket::VideoFormat* best_format) override; cricket::CaptureState Start( const cricket::VideoFormat& capture_format) override; - bool Pause(bool pause) override; void Stop() override; bool IsRunning() override; bool IsScreencast() const override; @@ -86,6 +86,7 @@ class WebrtcVideoCapturerAdapter : public cricket::VideoCapturer, scoped_ptr yuv_frame_; bool capture_pending_ = false; + bool paused_ = false; base::WeakPtrFactory weak_factory_; diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc index 02db96d..b43f189 100644 --- a/remoting/protocol/webrtc_video_stream.cc +++ b/remoting/protocol/webrtc_video_stream.cc @@ -68,7 +68,7 @@ bool WebrtcVideoStream::Start( void WebrtcVideoStream::Pause(bool pause) { if (capturer_adapter_) - capturer_adapter_->Pause(pause); + capturer_adapter_->PauseCapturer(pause); } void WebrtcVideoStream::OnInputEventReceived(int64_t event_timestamp) { -- cgit v1.1