summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/protocol/webrtc_video_capturer_adapter.cc20
-rw-r--r--remoting/protocol/webrtc_video_capturer_adapter.h3
-rw-r--r--remoting/protocol/webrtc_video_stream.cc2
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) {