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

Unified Diff: webrtc/modules/video_coding/video_sender.cc

Issue 2953053002: Reland of Periodically update codec bit/frame rate settings. (Closed)
Patch Set: Fix bug and add test Created 3 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/modules/video_coding/media_optimization.cc ('k') | webrtc/test/fake_encoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/video_sender.cc
diff --git a/webrtc/modules/video_coding/video_sender.cc b/webrtc/modules/video_coding/video_sender.cc
index ab7729745e56710c5d0ce497762b440865204ec7..3dabbfca097cc90a8aef8a30a2bff309fcdaaf39 100644
--- a/webrtc/modules/video_coding/video_sender.cc
+++ b/webrtc/modules/video_coding/video_sender.cc
@@ -103,6 +103,11 @@ int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec,
numLayers = sendCodec->VP8().numberOfTemporalLayers;
} else if (sendCodec->codecType == kVideoCodecVP9) {
numLayers = sendCodec->VP9().numberOfTemporalLayers;
+ } else if (sendCodec->codecType == kVideoCodecGeneric &&
+ sendCodec->numberOfSimulcastStreams > 0) {
+ // This is mainly for unit testing, disabling frame dropping.
+ // TODO(sprang): Add a better way to disable frame dropping.
+ numLayers = sendCodec->simulcastStream[0].numberOfTemporalLayers;
} else {
numLayers = 1;
}
@@ -197,13 +202,17 @@ EncoderParameters VideoSender::UpdateEncoderParameters(
input_frame_rate = current_codec_.maxFramerate;
BitrateAllocation bitrate_allocation;
- if (bitrate_allocator) {
- bitrate_allocation = bitrate_allocator->GetAllocation(video_target_rate_bps,
- input_frame_rate);
- } else {
- DefaultVideoBitrateAllocator default_allocator(current_codec_);
- bitrate_allocation = default_allocator.GetAllocation(video_target_rate_bps,
- input_frame_rate);
+ // Only call allocators if bitrate > 0 (ie, not suspended), otherwise they
+ // might cap the bitrate to the min bitrate configured.
+ if (target_bitrate_bps > 0) {
+ if (bitrate_allocator) {
+ bitrate_allocation = bitrate_allocator->GetAllocation(
+ video_target_rate_bps, input_frame_rate);
+ } else {
+ DefaultVideoBitrateAllocator default_allocator(current_codec_);
+ bitrate_allocation = default_allocator.GetAllocation(
+ video_target_rate_bps, input_frame_rate);
+ }
}
EncoderParameters new_encoder_params = {bitrate_allocation, params.loss_rate,
params.rtt, input_frame_rate};
@@ -221,7 +230,7 @@ void VideoSender::UpdateChannelParemeters(
encoder_params_.target_bitrate.get_sum_bps());
target_rate = encoder_params_.target_bitrate;
}
- if (bitrate_updated_callback)
+ if (bitrate_updated_callback && target_rate.get_sum_bps() > 0)
bitrate_updated_callback->OnBitrateAllocationUpdated(target_rate);
}
@@ -236,7 +245,7 @@ int32_t VideoSender::SetChannelParameters(
encoder_params.rtt = rtt;
encoder_params = UpdateEncoderParameters(encoder_params, bitrate_allocator,
target_bitrate_bps);
- if (bitrate_updated_callback) {
+ if (bitrate_updated_callback && target_bitrate_bps > 0) {
bitrate_updated_callback->OnBitrateAllocationUpdated(
encoder_params.target_bitrate);
}
« no previous file with comments | « webrtc/modules/video_coding/media_optimization.cc ('k') | webrtc/test/fake_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698