Rename AutoMute to SuspendBelowMinBitrate
Changes all instances throughout the WebRTC stack. BUG=2436 R=mflodman@webrtc.org, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/3919004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5130 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
28bf50f0ec
commit
ce8e0936d9
@ -592,17 +592,14 @@ public:
|
||||
// Disables recording of debugging information.
|
||||
virtual int StopDebugRecording() = 0;
|
||||
|
||||
// Enables AutoMuter to turn off video when the rate drops below
|
||||
// Lets the sender suspend 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() = 0;
|
||||
virtual void SuspendBelowMinBitrate() = 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;
|
||||
// Returns true if SuspendBelowMinBitrate is engaged and the video has been
|
||||
// suspended due to bandwidth limitations; otherwise false.
|
||||
virtual bool VideoSuspended() const = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -47,10 +47,10 @@ MediaOptimization::MediaOptimization(int32_t id, Clock* clock)
|
||||
last_qm_update_time_(0),
|
||||
last_change_time_(0),
|
||||
num_layers_(0),
|
||||
muting_enabled_(false),
|
||||
video_muted_(false),
|
||||
muter_threshold_bps_(0),
|
||||
muter_window_bps_(0) {
|
||||
suspension_enabled_(false),
|
||||
video_suspended_(false),
|
||||
suspension_threshold_bps_(0),
|
||||
suspension_window_bps_(0) {
|
||||
memset(send_statistics_, 0, sizeof(send_statistics_));
|
||||
memset(incoming_frame_times_, -1, sizeof(incoming_frame_times_));
|
||||
}
|
||||
@ -193,7 +193,7 @@ uint32_t MediaOptimization::SetTargetRates(uint32_t target_bitrate,
|
||||
content_->ResetShortTermAvgData();
|
||||
}
|
||||
|
||||
CheckAutoMuteConditions();
|
||||
CheckSuspendConditions();
|
||||
|
||||
return target_bit_rate_;
|
||||
}
|
||||
@ -351,7 +351,7 @@ void MediaOptimization::EnableFrameDropper(bool enable) {
|
||||
bool MediaOptimization::DropFrame() {
|
||||
// Leak appropriate number of bytes.
|
||||
frame_dropper_->Leak((uint32_t)(InputFrameRate() + 0.5f));
|
||||
if (video_muted_) {
|
||||
if (video_suspended_) {
|
||||
return true; // Drop all frames when muted.
|
||||
}
|
||||
return frame_dropper_->DropFrame();
|
||||
@ -418,17 +418,13 @@ int32_t MediaOptimization::SelectQuality() {
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
void MediaOptimization::EnableAutoMuting(int threshold_bps, int window_bps) {
|
||||
void MediaOptimization::SuspendBelowMinBitrate(int threshold_bps,
|
||||
int window_bps) {
|
||||
assert(threshold_bps > 0 && window_bps >= 0);
|
||||
muter_threshold_bps_ = threshold_bps;
|
||||
muter_window_bps_ = window_bps;
|
||||
muting_enabled_ = true;
|
||||
video_muted_ = false;
|
||||
}
|
||||
|
||||
void MediaOptimization::DisableAutoMuting() {
|
||||
muting_enabled_ = false;
|
||||
video_muted_ = false;
|
||||
suspension_threshold_bps_ = threshold_bps;
|
||||
suspension_window_bps_ = window_bps;
|
||||
suspension_enabled_ = true;
|
||||
video_suspended_ = false;
|
||||
}
|
||||
|
||||
// Private methods below this line.
|
||||
@ -605,19 +601,20 @@ void MediaOptimization::ProcessIncomingFrameRate(int64_t now) {
|
||||
}
|
||||
}
|
||||
|
||||
void MediaOptimization::CheckAutoMuteConditions() {
|
||||
// Check conditions for AutoMute. |target_bit_rate_| is in bps.
|
||||
if (muting_enabled_) {
|
||||
if (!video_muted_) {
|
||||
void MediaOptimization::CheckSuspendConditions() {
|
||||
// Check conditions for SuspendBelowMinBitrate. |target_bit_rate_| is in bps.
|
||||
if (suspension_enabled_) {
|
||||
if (!video_suspended_) {
|
||||
// Check if we just went below the threshold.
|
||||
if (target_bit_rate_ < muter_threshold_bps_) {
|
||||
video_muted_ = true;
|
||||
if (target_bit_rate_ < suspension_threshold_bps_) {
|
||||
video_suspended_ = true;
|
||||
}
|
||||
} else {
|
||||
// Video is already muted. Check if we just went over the threshold
|
||||
// Video is already suspended. Check if we just went over the threshold
|
||||
// with a margin.
|
||||
if (target_bit_rate_ > muter_threshold_bps_ + muter_window_bps_) {
|
||||
video_muted_ = false;
|
||||
if (target_bit_rate_ >
|
||||
suspension_threshold_bps_ + suspension_window_bps_) {
|
||||
video_suspended_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,18 +120,15 @@ class MediaOptimization {
|
||||
// Computes new Quality Mode.
|
||||
int32_t SelectQuality();
|
||||
|
||||
// Enables AutoMuter to turn off video when the rate drops below
|
||||
// Lets the sender suspend video when the rate drops below
|
||||
// |threshold_bps|, and turns back on when the rate goes back up above
|
||||
// |threshold_bps| + |window_bps|.
|
||||
void EnableAutoMuting(int threshold_bps, int window_bps);
|
||||
|
||||
// Disables AutoMuter.
|
||||
void DisableAutoMuting();
|
||||
void SuspendBelowMinBitrate(int threshold_bps, int window_bps);
|
||||
|
||||
// Accessors and mutators.
|
||||
int32_t max_bit_rate() const { return max_bit_rate_; }
|
||||
void set_max_payload_size(int32_t mtu) { max_payload_size_ = mtu; }
|
||||
bool video_muted() const { return video_muted_; }
|
||||
bool video_suspended() const { return video_suspended_; }
|
||||
|
||||
private:
|
||||
typedef std::list<EncodedFrameSample> FrameSampleList;
|
||||
@ -161,10 +158,10 @@ class MediaOptimization {
|
||||
|
||||
void ProcessIncomingFrameRate(int64_t now);
|
||||
|
||||
// Checks conditions for AutoMute. The method compares |target_bit_rate_|
|
||||
// with the threshold values for AutoMute, and changes the state of
|
||||
// |video_muted_| accordingly.
|
||||
void CheckAutoMuteConditions();
|
||||
// Checks conditions for suspending the video. The method compares
|
||||
// |target_bit_rate_| with the threshold values for suspension, and changes
|
||||
// the state of |video_suspended_| accordingly.
|
||||
void CheckSuspendConditions();
|
||||
|
||||
int32_t id_;
|
||||
Clock* clock_;
|
||||
@ -195,10 +192,10 @@ class MediaOptimization {
|
||||
int64_t last_qm_update_time_;
|
||||
int64_t last_change_time_; // Content/user triggered.
|
||||
int num_layers_;
|
||||
bool muting_enabled_;
|
||||
bool video_muted_;
|
||||
int muter_threshold_bps_;
|
||||
int muter_window_bps_;
|
||||
bool suspension_enabled_;
|
||||
bool video_suspended_;
|
||||
int suspension_threshold_bps_;
|
||||
int suspension_window_bps_;
|
||||
}; // End of MediaOptimization class declaration.
|
||||
|
||||
} // namespace media_optimization
|
||||
|
@ -55,15 +55,15 @@ class TestMediaOptimization : public ::testing::Test {
|
||||
|
||||
|
||||
TEST_F(TestMediaOptimization, VerifyMuting) {
|
||||
// Enable video muter with these limits.
|
||||
// Mute the video when the rate is below 50 kbps and unmute when it gets above
|
||||
// 50 + 10 kbps again.
|
||||
// Enable video suspension with these limits.
|
||||
// Suspend the video when the rate is below 50 kbps and resume when it gets
|
||||
// above 50 + 10 kbps again.
|
||||
const int kThresholdBps = 50000;
|
||||
const int kWindowBps = 10000;
|
||||
media_opt_.EnableAutoMuting(kThresholdBps, kWindowBps);
|
||||
media_opt_.SuspendBelowMinBitrate(kThresholdBps, kWindowBps);
|
||||
|
||||
// The video should not be muted from the start.
|
||||
EXPECT_FALSE(media_opt_.video_muted());
|
||||
// The video should not be suspended from the start.
|
||||
EXPECT_FALSE(media_opt_.video_suspended());
|
||||
|
||||
int target_bitrate_kbps = 100;
|
||||
media_opt_.SetTargetRates(target_bitrate_kbps * 1000,
|
||||
@ -81,7 +81,7 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
|
||||
// Expect the muter to engage immediately and stay muted.
|
||||
// Test during 2 seconds.
|
||||
for (int time = 0; time < 2000; time += frame_time_ms_) {
|
||||
EXPECT_TRUE(media_opt_.video_muted());
|
||||
EXPECT_TRUE(media_opt_.video_suspended());
|
||||
ASSERT_NO_FATAL_FAILURE(AddFrameAndAdvanceTime(target_bitrate_kbps, true));
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
|
||||
// Expect the muter to stay muted.
|
||||
// Test during 2 seconds.
|
||||
for (int time = 0; time < 2000; time += frame_time_ms_) {
|
||||
EXPECT_TRUE(media_opt_.video_muted());
|
||||
EXPECT_TRUE(media_opt_.video_suspended());
|
||||
ASSERT_NO_FATAL_FAILURE(AddFrameAndAdvanceTime(target_bitrate_kbps, true));
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ TEST_F(TestMediaOptimization, VerifyMuting) {
|
||||
// Expect the muter to disengage immediately.
|
||||
// Test during 2 seconds.
|
||||
for (int time = 0; time < 2000; time += frame_time_ms_) {
|
||||
EXPECT_FALSE(media_opt_.video_muted());
|
||||
EXPECT_FALSE(media_opt_.video_suspended());
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
AddFrameAndAdvanceTime((kThresholdBps + kWindowBps) / 1000, false));
|
||||
}
|
||||
|
@ -197,16 +197,12 @@ class VideoCodingModuleImpl : public VideoCodingModule {
|
||||
return sender_->StopDebugRecording();
|
||||
}
|
||||
|
||||
virtual void EnableAutoMuting() {
|
||||
return sender_->EnableAutoMuting();
|
||||
virtual void SuspendBelowMinBitrate() {
|
||||
return sender_->SuspendBelowMinBitrate();
|
||||
}
|
||||
|
||||
virtual void DisableAutoMuting() {
|
||||
return sender_->DisableAutoMuting();
|
||||
}
|
||||
|
||||
virtual bool VideoMuted() const {
|
||||
return sender_->VideoMuted();
|
||||
virtual bool VideoSuspended() const {
|
||||
return sender_->VideoSuspended();
|
||||
}
|
||||
|
||||
virtual int32_t InitializeReceiver() OVERRIDE {
|
||||
|
@ -95,9 +95,8 @@ class VideoSender {
|
||||
int StartDebugRecording(const char* file_name_utf8);
|
||||
int StopDebugRecording();
|
||||
|
||||
void EnableAutoMuting();
|
||||
void DisableAutoMuting();
|
||||
bool VideoMuted() const;
|
||||
void SuspendBelowMinBitrate();
|
||||
bool VideoSuspended() const;
|
||||
|
||||
int32_t TimeUntilNextProcess();
|
||||
int32_t Process();
|
||||
|
@ -422,11 +422,11 @@ int VideoSender::StopDebugRecording() {
|
||||
return VCM_OK;
|
||||
}
|
||||
|
||||
void VideoSender::EnableAutoMuting() {
|
||||
void VideoSender::SuspendBelowMinBitrate() {
|
||||
CriticalSectionScoped cs(_sendCritSect);
|
||||
VideoCodec current_send_codec;
|
||||
if (SendCodec(¤t_send_codec) != 0) {
|
||||
assert(false); // Must set a send codec before enabling auto-mute.
|
||||
assert(false); // Must set a send codec before SuspendBelowMinBitrate.
|
||||
return;
|
||||
}
|
||||
int threshold_bps;
|
||||
@ -438,17 +438,12 @@ void VideoSender::EnableAutoMuting() {
|
||||
// Set the hysteresis window to be at 10% of the threshold, but at least
|
||||
// 10 kbps.
|
||||
int window_bps = std::max(threshold_bps / 10, 10000);
|
||||
_mediaOpt.EnableAutoMuting(threshold_bps, window_bps);
|
||||
_mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps);
|
||||
}
|
||||
|
||||
void VideoSender::DisableAutoMuting() {
|
||||
bool VideoSender::VideoSuspended() const {
|
||||
CriticalSectionScoped cs(_sendCritSect);
|
||||
_mediaOpt.DisableAutoMuting();
|
||||
}
|
||||
|
||||
bool VideoSender::VideoMuted() const {
|
||||
CriticalSectionScoped cs(_sendCritSect);
|
||||
return _mediaOpt.video_muted();
|
||||
return _mediaOpt.video_suspended();
|
||||
}
|
||||
|
||||
} // namespace vcm
|
||||
|
@ -198,8 +198,8 @@ VideoSendStream::VideoSendStream(newapi::Transport* transport,
|
||||
image_process_->RegisterPreEncodeCallback(channel_,
|
||||
config_.pre_encode_callback);
|
||||
|
||||
if (config.auto_mute) {
|
||||
codec_->EnableAutoMuting(channel_);
|
||||
if (config.suspend_below_min_bitrate) {
|
||||
codec_->SuspendBelowMinBitrate(channel_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,13 +550,13 @@ TEST_F(VideoSendStreamTest, CanChangeSendCodec) {
|
||||
// The test will go through a number of phases.
|
||||
// 1. Start sending packets.
|
||||
// 2. As soon as the RTP stream has been detected, signal a low REMB value to
|
||||
// activate the auto muter.
|
||||
// 3. Wait until |kMuteTimeFrames| have been captured without seeing any RTP
|
||||
// suspend the stream.
|
||||
// 3. Wait until |kSuspendTimeFrames| have been captured without seeing any RTP
|
||||
// packets.
|
||||
// 4. Signal a high REMB and the wait for the RTP stream to start again.
|
||||
// 4. Signal a high REMB and then wait for the RTP stream to start again.
|
||||
// When the stream is detected again, the test ends.
|
||||
TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
static const int kMuteTimeFrames = 60; // Mute for 2 seconds @ 30 fps.
|
||||
TEST_F(VideoSendStreamTest, SuspendBelowMinBitrate) {
|
||||
static const int kSuspendTimeFrames = 60; // Suspend for 2 seconds @ 30 fps.
|
||||
|
||||
class RembObserver : public test::RtpRtcpObserver, public I420FrameCallback {
|
||||
public:
|
||||
@ -564,10 +564,10 @@ TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
: RtpRtcpObserver(30 * 1000), // Timeout after 30 seconds.
|
||||
transport_adapter_(&transport_),
|
||||
clock_(Clock::GetRealTimeClock()),
|
||||
test_state_(kBeforeMute),
|
||||
test_state_(kBeforeSuspend),
|
||||
rtp_count_(0),
|
||||
last_sequence_number_(0),
|
||||
mute_frame_count_(0),
|
||||
suspended_frame_count_(0),
|
||||
low_remb_bps_(0),
|
||||
high_remb_bps_(0),
|
||||
crit_sect_(CriticalSectionWrapper::CreateCriticalSection()) {}
|
||||
@ -591,12 +591,12 @@ TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
EXPECT_TRUE(parser_->Parse(packet, static_cast<int>(length), &header));
|
||||
last_sequence_number_ = header.sequenceNumber;
|
||||
|
||||
if (test_state_ == kBeforeMute) {
|
||||
// The stream has started. Try to mute it.
|
||||
if (test_state_ == kBeforeSuspend) {
|
||||
// The stream has started. Try to suspend it.
|
||||
SendRtcpFeedback(low_remb_bps_);
|
||||
test_state_ = kDuringMute;
|
||||
} else if (test_state_ == kDuringMute) {
|
||||
mute_frame_count_ = 0;
|
||||
test_state_ = kDuringSuspend;
|
||||
} else if (test_state_ == kDuringSuspend) {
|
||||
suspended_frame_count_ = 0;
|
||||
} else if (test_state_ == kWaitingForPacket) {
|
||||
observation_complete_->Set();
|
||||
}
|
||||
@ -607,7 +607,8 @@ TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
// This method implements the I420FrameCallback.
|
||||
void FrameCallback(I420VideoFrame* video_frame) OVERRIDE {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
if (test_state_ == kDuringMute && ++mute_frame_count_ > kMuteTimeFrames) {
|
||||
if (test_state_ == kDuringSuspend &&
|
||||
++suspended_frame_count_ > kSuspendTimeFrames) {
|
||||
SendRtcpFeedback(high_remb_bps_);
|
||||
test_state_ = kWaitingForPacket;
|
||||
}
|
||||
@ -621,10 +622,10 @@ TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
|
||||
private:
|
||||
enum TestState {
|
||||
kBeforeMute,
|
||||
kDuringMute,
|
||||
kBeforeSuspend,
|
||||
kDuringSuspend,
|
||||
kWaitingForPacket,
|
||||
kAfterMute
|
||||
kAfterSuspend
|
||||
};
|
||||
|
||||
virtual void SendRtcpFeedback(int remb_value) {
|
||||
@ -649,7 +650,7 @@ TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
TestState test_state_;
|
||||
int rtp_count_;
|
||||
int last_sequence_number_;
|
||||
int mute_frame_count_;
|
||||
int suspended_frame_count_;
|
||||
int low_remb_bps_;
|
||||
int high_remb_bps_;
|
||||
scoped_ptr<CriticalSectionWrapper> crit_sect_;
|
||||
@ -662,7 +663,7 @@ TEST_F(VideoSendStreamTest, AutoMute) {
|
||||
VideoSendStream::Config send_config = GetSendTestConfig(call.get());
|
||||
send_config.rtp.nack.rtp_history_ms = 1000;
|
||||
send_config.pre_encode_callback = &observer;
|
||||
send_config.auto_mute = true;
|
||||
send_config.suspend_below_min_bitrate = true;
|
||||
unsigned int min_bitrate_bps =
|
||||
send_config.codec.simulcastStream[0].minBitrate * 1000;
|
||||
observer.set_low_remb_bps(min_bitrate_bps - 10000);
|
||||
|
@ -36,10 +36,10 @@ class WEBRTC_DLLEXPORT ViEEncoderObserver {
|
||||
const unsigned int framerate,
|
||||
const unsigned int bitrate) = 0;
|
||||
|
||||
// This method is called whenever the state of the AutoMuter changes, i.e.,
|
||||
// when |is_muted| toggles.
|
||||
// This method is called whenever the state of the SuspendBelowMinBitrate
|
||||
// changes, i.e., when |is_suspended| toggles.
|
||||
// TODO(hlundin): Remove the default implementation when possible.
|
||||
virtual void VideoAutoMuted(int video_channel, bool is_muted) {}
|
||||
virtual void VideoSuspended(int video_channel, bool is_suspended) {}
|
||||
|
||||
protected:
|
||||
virtual ~ViEEncoderObserver() {}
|
||||
@ -193,12 +193,12 @@ class WEBRTC_DLLEXPORT ViECodec {
|
||||
// Disables recording of debugging information.
|
||||
virtual int StopDebugRecording(int video_channel) = 0;
|
||||
|
||||
// Enables AutoMuter to turn off video when the rate drops below
|
||||
// Lets the sender suspend video when the rate drops below
|
||||
// |threshold_bps|, and turns back on when the rate goes back up above
|
||||
// |threshold_bps| + |window_bps|.
|
||||
// This is under development; not tested.
|
||||
// TODO(hlundin): Remove the default implementation when possible.
|
||||
virtual void EnableAutoMuting(int video_channel) {}
|
||||
virtual void SuspendBelowMinBitrate(int video_channel) {}
|
||||
|
||||
protected:
|
||||
ViECodec() {}
|
||||
|
@ -44,7 +44,7 @@ class TestCodecObserver : public webrtc::ViEEncoderObserver,
|
||||
unsigned int last_outgoing_bitrate_;
|
||||
unsigned int last_incoming_framerate_;
|
||||
unsigned int last_incoming_bitrate_;
|
||||
unsigned int video_auto_muted_called_;
|
||||
unsigned int video_suspended_called_;
|
||||
|
||||
webrtc::VideoCodec incoming_codec_;
|
||||
|
||||
@ -60,7 +60,7 @@ class TestCodecObserver : public webrtc::ViEEncoderObserver,
|
||||
last_outgoing_bitrate_(0),
|
||||
last_incoming_framerate_(0),
|
||||
last_incoming_bitrate_(0),
|
||||
video_auto_muted_called_(0) {
|
||||
video_suspended_called_(0) {
|
||||
memset(&incoming_codec_, 0, sizeof(incoming_codec_));
|
||||
}
|
||||
virtual void IncomingCodecChanged(const int video_channel,
|
||||
@ -100,8 +100,8 @@ class TestCodecObserver : public webrtc::ViEEncoderObserver,
|
||||
last_outgoing_bitrate_ += bitrate;
|
||||
}
|
||||
|
||||
virtual void VideoAutoMuted(int video_channel, bool is_muted) {
|
||||
video_auto_muted_called_++;
|
||||
virtual void VideoSuspended(int video_channel, bool is_suspended) OVERRIDE {
|
||||
video_suspended_called_++;
|
||||
}
|
||||
|
||||
virtual void RequestNewKeyFrame(const int video_channel) {
|
||||
|
@ -73,8 +73,8 @@ class ViEAutotestEncoderObserver : public webrtc::ViEEncoderObserver {
|
||||
<< " BR: " << bitrate << std::endl;
|
||||
}
|
||||
|
||||
virtual void VideoAutoMuted(int video_channel, bool is_muted) {
|
||||
std::cout << "VideoAutoMuted: " << is_muted << std::endl;
|
||||
virtual void VideoSuspended(int video_channel, bool is_suspended) OVERRIDE {
|
||||
std::cout << "VideoSuspended: " << is_suspended << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -715,7 +715,7 @@ int ViECodecImpl::StopDebugRecording(int video_channel) {
|
||||
return vie_encoder->StopDebugRecording();
|
||||
}
|
||||
|
||||
void ViECodecImpl::EnableAutoMuting(int video_channel) {
|
||||
void ViECodecImpl::SuspendBelowMinBitrate(int video_channel) {
|
||||
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
|
||||
ViEEncoder* vie_encoder = cs.Encoder(video_channel);
|
||||
if (!vie_encoder) {
|
||||
@ -724,7 +724,7 @@ void ViECodecImpl::EnableAutoMuting(int video_channel) {
|
||||
"%s: No encoder %d", __FUNCTION__, video_channel);
|
||||
return;
|
||||
}
|
||||
return vie_encoder->EnableAutoMuting();
|
||||
return vie_encoder->SuspendBelowMinBitrate();
|
||||
}
|
||||
|
||||
bool ViECodecImpl::CodecValid(const VideoCodec& video_codec) {
|
||||
|
@ -70,7 +70,7 @@ class ViECodecImpl
|
||||
virtual int StartDebugRecording(int video_channel,
|
||||
const char* file_name_utf8);
|
||||
virtual int StopDebugRecording(int video_channel);
|
||||
virtual void EnableAutoMuting(int video_channel);
|
||||
virtual void SuspendBelowMinBitrate(int video_channel);
|
||||
|
||||
protected:
|
||||
explicit ViECodecImpl(ViESharedData* shared_data);
|
||||
|
@ -163,7 +163,7 @@ ViEEncoder::ViEEncoder(int32_t engine_id,
|
||||
has_received_rpsi_(false),
|
||||
picture_id_rpsi_(0),
|
||||
qm_callback_(NULL),
|
||||
video_auto_muted_(false),
|
||||
video_suspended_(false),
|
||||
pre_encode_callback_(NULL) {
|
||||
WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceVideo,
|
||||
ViEId(engine_id, channel_id),
|
||||
@ -1050,7 +1050,7 @@ void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps,
|
||||
__FUNCTION__, bitrate_bps, fraction_lost, round_trip_time_ms);
|
||||
|
||||
vcm_.SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms);
|
||||
bool video_is_muted = vcm_.VideoMuted();
|
||||
bool video_is_suspended = vcm_.VideoSuspended();
|
||||
int bitrate_kbps = bitrate_bps / 1000;
|
||||
VideoCodec send_codec;
|
||||
if (vcm_.SendCodec(&send_codec) != 0) {
|
||||
@ -1087,10 +1087,10 @@ void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps,
|
||||
pad_up_to_bitrate_kbps += stream_configs[i].targetBitrate;
|
||||
}
|
||||
}
|
||||
if (video_is_muted || send_codec.numberOfSimulcastStreams > 1) {
|
||||
if (video_is_suspended || send_codec.numberOfSimulcastStreams > 1) {
|
||||
pad_up_to_bitrate_kbps = std::min(bitrate_kbps, pad_up_to_bitrate_kbps);
|
||||
} else {
|
||||
// Disable padding if only sending one stream and video isn't muted.
|
||||
// Disable padding if only sending one stream and video isn't suspended.
|
||||
pad_up_to_bitrate_kbps = 0;
|
||||
}
|
||||
|
||||
@ -1107,15 +1107,15 @@ void ViEEncoder::OnNetworkChanged(const uint32_t bitrate_bps,
|
||||
max_padding_bitrate_kbps,
|
||||
pad_up_to_bitrate_kbps);
|
||||
default_rtp_rtcp_->SetTargetSendBitrate(stream_bitrates);
|
||||
if (video_is_muted != video_auto_muted_) {
|
||||
if (video_is_suspended != video_suspended_) {
|
||||
// State changed now. Send callback to inform about that.
|
||||
video_auto_muted_ = video_is_muted;
|
||||
video_suspended_ = video_is_suspended;
|
||||
if (codec_observer_) {
|
||||
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideo,
|
||||
ViEId(engine_id_, channel_id_),
|
||||
"%s: video_auto_muted_ changed to %i",
|
||||
__FUNCTION__, video_auto_muted_);
|
||||
codec_observer_->VideoAutoMuted(channel_id_, video_auto_muted_);
|
||||
"%s: video_suspended_ changed to %i",
|
||||
__FUNCTION__, video_suspended_);
|
||||
codec_observer_->VideoSuspended(channel_id_, video_suspended_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1159,8 +1159,8 @@ int ViEEncoder::StopDebugRecording() {
|
||||
return vcm_.StopDebugRecording();
|
||||
}
|
||||
|
||||
void ViEEncoder::EnableAutoMuting() {
|
||||
vcm_.EnableAutoMuting();
|
||||
void ViEEncoder::SuspendBelowMinBitrate() {
|
||||
vcm_.SuspendBelowMinBitrate();
|
||||
bitrate_controller_->EnforceMinBitrate(false);
|
||||
}
|
||||
|
||||
|
@ -163,10 +163,10 @@ class ViEEncoder
|
||||
// Disables recording of debugging information.
|
||||
virtual int StopDebugRecording();
|
||||
|
||||
// Enables AutoMuter to turn off video when the rate drops below
|
||||
// Lets the sender suspend 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();
|
||||
virtual void SuspendBelowMinBitrate();
|
||||
|
||||
// New-style callback, used by VideoSendStream.
|
||||
void RegisterPreEncodeCallback(I420FrameCallback* pre_encode_callback);
|
||||
@ -226,7 +226,7 @@ class ViEEncoder
|
||||
|
||||
// Quality modes callback
|
||||
QMVideoSettingsCallback* qm_callback_;
|
||||
bool video_auto_muted_;
|
||||
bool video_suspended_;
|
||||
I420FrameCallback* pre_encode_callback_;
|
||||
};
|
||||
|
||||
|
@ -79,7 +79,7 @@ class VideoSendStream {
|
||||
target_delay_ms(0),
|
||||
pacing(false),
|
||||
stats_callback(NULL),
|
||||
auto_mute(false) {}
|
||||
suspend_below_min_bitrate(false) {}
|
||||
VideoCodec codec;
|
||||
|
||||
static const size_t kDefaultMaxPacketSize = 1500 - 40; // TCP over IPv4.
|
||||
@ -142,10 +142,10 @@ class VideoSendStream {
|
||||
// Callback for periodically receiving send stats.
|
||||
StatsCallback* stats_callback;
|
||||
|
||||
// True if video should be muted when video goes under the minimum video
|
||||
// bitrate. Unless muted, video will be sent at a bitrate higher than
|
||||
// estimated available.
|
||||
bool auto_mute;
|
||||
// True if the stream should be suspended when the available bitrate fall
|
||||
// below the minimum configured bitrate. If this variable is false, the
|
||||
// stream may send at a rate higher than the estimated available bitrate.
|
||||
bool suspend_below_min_bitrate;
|
||||
};
|
||||
|
||||
// Gets interface used to insert captured frames. Valid as long as the
|
||||
|
Loading…
Reference in New Issue
Block a user