From 572699d3eb4e57c60d1fa2d0664d37cf6510d1b3 Mon Sep 17 00:00:00 2001 From: "henrik.lundin@webrtc.org" Date: Mon, 30 Sep 2013 12:16:08 +0000 Subject: [PATCH] Propagate AutoMuter interface out to VideoCodingModule BUG=2436 R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2311004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4878 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../video_coding/main/interface/video_coding.h | 12 ++++++++++++ .../video_coding/main/source/video_coding_impl.cc | 12 ++++++++++++ .../video_coding/main/source/video_coding_impl.h | 4 ++++ .../video_coding/main/source/video_sender.cc | 15 +++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/webrtc/modules/video_coding/main/interface/video_coding.h b/webrtc/modules/video_coding/main/interface/video_coding.h index c4bb744cd6..2b3c94bff2 100644 --- a/webrtc/modules/video_coding/main/interface/video_coding.h +++ b/webrtc/modules/video_coding/main/interface/video_coding.h @@ -579,6 +579,18 @@ public: // Disables recording of debugging information. virtual int StopDebugRecording() = 0; + + // Enables AutoMuter to turn off video when the rate drops below + // |threshold_bps|, and turns back on when the rate goes back up above + // |threshold_bps| + |window_bps|. + virtual void EnableAutoMuting(int threshold_bps, int window_bps) = 0; + + // Disables AutoMuter. + virtual void DisableAutoMuting() = 0; + + // Returns true if AutoMuter is engaged and the video has been muted due to + // bandwidth limitations; otherwise false. + virtual bool VideoMuted() const = 0; }; } // namespace webrtc diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.cc b/webrtc/modules/video_coding/main/source/video_coding_impl.cc index 098c4fb44f..922ecb4334 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.cc +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.cc @@ -197,6 +197,18 @@ class VideoCodingModuleImpl : public VideoCodingModule { return sender_->StopDebugRecording(); } + virtual void EnableAutoMuting(int threshold_bps, int window_bps) { + return sender_->EnableAutoMuting(threshold_bps, window_bps); + } + + virtual void DisableAutoMuting() { + return sender_->DisableAutoMuting(); + } + + virtual bool VideoMuted() const { + return sender_->VideoMuted(); + } + virtual int32_t InitializeReceiver() OVERRIDE { return receiver_->InitializeReceiver(); } diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.h b/webrtc/modules/video_coding/main/source/video_coding_impl.h index a7a6e4fc30..0605ae3078 100644 --- a/webrtc/modules/video_coding/main/source/video_coding_impl.h +++ b/webrtc/modules/video_coding/main/source/video_coding_impl.h @@ -95,6 +95,10 @@ class VideoSender { int StartDebugRecording(const char* file_name_utf8); int StopDebugRecording(); + void EnableAutoMuting(int threshold_bps, int window_bps); + void DisableAutoMuting(); + bool VideoMuted() const; + int32_t TimeUntilNextProcess(); int32_t Process(); diff --git a/webrtc/modules/video_coding/main/source/video_sender.cc b/webrtc/modules/video_coding/main/source/video_sender.cc index 26e31e0c67..d7ed3cf127 100644 --- a/webrtc/modules/video_coding/main/source/video_sender.cc +++ b/webrtc/modules/video_coding/main/source/video_sender.cc @@ -420,5 +420,20 @@ int VideoSender::StopDebugRecording() { return VCM_OK; } +void VideoSender::EnableAutoMuting(int threshold_bps, int window_bps) { + CriticalSectionScoped cs(_sendCritSect); + return _mediaOpt.EnableAutoMuting(threshold_bps, window_bps); +} + +void VideoSender::DisableAutoMuting() { + CriticalSectionScoped cs(_sendCritSect); + return _mediaOpt.DisableAutoMuting(); +} + +bool VideoSender::VideoMuted() const { + CriticalSectionScoped cs(_sendCritSect); + return _mediaOpt.video_muted(); +} + } // namespace vcm } // namespace webrtc