Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1048)

Unified Diff: webrtc/video/vie_encoder.cc

Issue 2035383002: Implementing auto pausing of video streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/vie_encoder.cc
diff --git a/webrtc/video/vie_encoder.cc b/webrtc/video/vie_encoder.cc
index 73b29f319e03484081c37e59448f3fde8d2ea431..529b38f5b824b28226b8fb42257d58c5c5f8cb9b 100644
--- a/webrtc/video/vie_encoder.cc
+++ b/webrtc/video/vie_encoder.cc
@@ -132,8 +132,8 @@ void ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec,
int ViEEncoder::GetPaddingNeededBps() const {
int64_t time_of_last_frame_activity_ms;
int min_transmit_bitrate_bps;
- int bitrate_bps;
VideoCodec send_codec;
+ bool video_is_suspended;
{
rtc::CritScope lock(&data_cs_);
bool send_padding = encoder_config_.numberOfSimulcastStreams > 1 ||
@@ -142,12 +142,10 @@ int ViEEncoder::GetPaddingNeededBps() const {
return 0;
time_of_last_frame_activity_ms = time_of_last_frame_activity_ms_;
min_transmit_bitrate_bps = min_transmit_bitrate_bps_;
- bitrate_bps = last_observed_bitrate_bps_;
send_codec = encoder_config_;
+ video_is_suspended = video_suspended_;
}
- bool video_is_suspended = video_sender_.VideoSuspended();
-
// Find the max amount of padding we can allow ourselves to send at this
// point, based on which streams are currently active and what our current
// available bandwidth is.
@@ -179,10 +177,6 @@ int ViEEncoder::GetPaddingNeededBps() const {
if (pad_up_to_bitrate_bps < min_transmit_bitrate_bps)
pad_up_to_bitrate_bps = min_transmit_bitrate_bps;
- // Padding may never exceed bitrate estimate.
- if (pad_up_to_bitrate_bps > bitrate_bps)
- pad_up_to_bitrate_bps = bitrate_bps;
-
return pad_up_to_bitrate_bps;
}
@@ -320,8 +314,8 @@ void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
<< " rtt " << round_trip_time_ms;
video_sender_.SetChannelParameters(bitrate_bps, fraction_lost,
round_trip_time_ms);
- bool video_is_suspended = video_sender_.VideoSuspended();
bool video_suspension_changed;
+ bool video_is_suspended = bitrate_bps == 0;
{
rtc::CritScope lock(&data_cs_);
last_observed_bitrate_bps_ = bitrate_bps;
@@ -329,13 +323,10 @@ void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
video_suspended_ = video_is_suspended;
}
- if (!video_suspension_changed)
- return;
- // Video suspend-state changed, inform codec observer.
- LOG(LS_INFO) << "Video suspend state changed " << video_is_suspended;
-
- if (stats_proxy_)
+ if (stats_proxy_ && video_suspension_changed) {
+ LOG(LS_INFO) << "Video suspend state changed " << video_is_suspended;
stats_proxy_->OnSuspendChange(video_is_suspended);
+ }
}
} // namespace webrtc
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698