From 4a3a135e68154488289d4aa4a987475912faa7be Mon Sep 17 00:00:00 2001 From: perkj Date: Thu, 24 Mar 2016 04:39:49 -0700 Subject: [PATCH] More cleanup of cricket::VideoCapturer Remove unused state CS_PAUSED and dummy implementation of Pause() Remove unused SignalVideoFrame This should now be possible since https://codereview.chromium.org/1745923002/ has landed. BUG=webrtc:5426 Review URL: https://codereview.webrtc.org/1832793002 Cr-Commit-Position: refs/heads/master@{#12116} --- webrtc/api/videocapturertracksource.cc | 2 -- webrtc/media/base/videocapturer.cc | 6 +----- webrtc/media/base/videocapturer.h | 20 +++----------------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/webrtc/api/videocapturertracksource.cc b/webrtc/api/videocapturertracksource.cc index e292c7a065..1e9e35382c 100644 --- a/webrtc/api/videocapturertracksource.cc +++ b/webrtc/api/videocapturertracksource.cc @@ -49,8 +49,6 @@ MediaSourceInterface::SourceState GetReadyState(cricket::CaptureState state) { case cricket::CS_FAILED: case cricket::CS_STOPPED: return MediaSourceInterface::kEnded; - case cricket::CS_PAUSED: - return MediaSourceInterface::kMuted; default: ASSERT(false && "GetReadyState unknown state"); } diff --git a/webrtc/media/base/videocapturer.cc b/webrtc/media/base/videocapturer.cc index a98f2f547f..6b182b3533 100644 --- a/webrtc/media/base/videocapturer.cc +++ b/webrtc/media/base/videocapturer.cc @@ -72,10 +72,6 @@ void VideoCapturer::Construct() { square_pixel_aspect_ratio_ = false; capture_state_ = CS_STOPPED; SignalFrameCaptured.connect(this, &VideoCapturer::OnFrameCaptured); - // TODO(perkj) SignalVideoFrame is used directly by Chrome remoting. - // Before that is refactored, SignalVideoFrame must forward frames to the - // |VideoBroadcaster|; - SignalVideoFrame.connect(this, &VideoCapturer::OnFrame); scaled_width_ = 0; scaled_height_ = 0; enable_video_adapter_ = true; @@ -394,7 +390,7 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*, return; } - SignalVideoFrame(this, adapted_frame.get()); + OnFrame(this, adapted_frame.get()); UpdateStats(captured_frame); } diff --git a/webrtc/media/base/videocapturer.h b/webrtc/media/base/videocapturer.h index ac2bee2b30..4ad102b7f2 100644 --- a/webrtc/media/base/videocapturer.h +++ b/webrtc/media/base/videocapturer.h @@ -38,7 +38,6 @@ enum CaptureState { // still fail to start. CS_RUNNING, // The capturer has been started successfully and is now // capturing. - CS_PAUSED, // The capturer has been paused. CS_FAILED, // The capturer failed to start. }; @@ -148,7 +147,6 @@ class VideoCapturer : public sigslot::has_slots<>, // CS_STARTING: The capturer is trying to start. Success or failure will // be notified via the |SignalStateChange| callback. // CS_RUNNING: if the capturer is started and capturing. - // CS_PAUSED: Will never be returned. // CS_FAILED: if the capturer failes to start.. // CS_NO_DEVICE: if the capturer has no device and fails to start. virtual CaptureState Start(const VideoFormat& capture_format) = 0; @@ -161,13 +159,6 @@ class VideoCapturer : public sigslot::has_slots<>, return capture_format_.get(); } - // Pause the video capturer. - // DEPRECATED - // TODO(perkj): Remove once Chrome remoting doesn't override this method. - virtual bool Pause(bool paused) { - RTC_NOTREACHED(); - return false; - } // Stop the video capturer. virtual void Stop() = 0; // Check if the video capturer is running. @@ -228,12 +219,6 @@ class VideoCapturer : public sigslot::has_slots<>, void RemoveSink(rtc::VideoSinkInterface* sink) override; protected: - // Signal the captured and possibly adapted frame to downstream consumers - // such as the encoder. - // TODO(perkj): Remove once it is not used by remoting in Chrome. - sigslot::signal2 SignalVideoFrame; - // OnSinkWantsChanged can be overridden to change the default behavior // when a sink changes its VideoSinkWants by calling AddOrUpdateSink. virtual void OnSinkWantsChanged(const rtc::VideoSinkWants& wants); @@ -242,8 +227,9 @@ class VideoCapturer : public sigslot::has_slots<>, void OnFrameCaptured(VideoCapturer* video_capturer, const CapturedFrame* captured_frame); - // Callback attached to SignalVideoFrame. - // TODO(perkj): Remove once SignalVideoFrame is removed. + // Called when a frame has been captured and converted to a VideoFrame. + // OnFrame can be called directly by an implementation that does not use + // SignalFrameCaptured or OnFrameCaptured. void OnFrame(VideoCapturer* capturer, const VideoFrame* frame); CoordinatedVideoAdapter* video_adapter() { return &video_adapter_; }