diff options
author | perkj <perkj@chromium.org> | 2016-03-24 01:24:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-24 08:25:56 +0000 |
commit | 1f29be6be1b2671cc73cd8f83045b7e4a208216b (patch) | |
tree | 745cfed1571d96cab9317b5080cfde6bcba5fa8c | |
parent | 3e4e2281b541d0dbb401d18a29eed06fcacfa3dd (diff) | |
download | chromium_src-1f29be6be1b2671cc73cd8f83045b7e4a208216b.zip chromium_src-1f29be6be1b2671cc73cd8f83045b7e4a208216b.tar.gz chromium_src-1f29be6be1b2671cc73cd8f83045b7e4a208216b.tar.bz2 |
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}
-rw-r--r-- | remoting/protocol/webrtc_video_capturer_adapter.cc | 20 | ||||
-rw-r--r-- | remoting/protocol/webrtc_video_capturer_adapter.h | 3 | ||||
-rw-r--r-- | remoting/protocol/webrtc_video_stream.cc | 2 |
3 files changed, 9 insertions, 16 deletions
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<WebrtcVideoCapturerAdapter> 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<cricket::VideoFrame> yuv_frame_; bool capture_pending_ = false; + bool paused_ = false; base::WeakPtrFactory<WebrtcVideoCapturerAdapter> 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) { |