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

Unified Diff: webrtc/modules/video_coding/main/source/media_optimization.cc

Issue 1428473002: Utilize bitrate above codec max to protect video. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: I bet this is what windows had problems with. :( Created 5 years, 2 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 | « no previous file | webrtc/modules/video_coding/main/source/media_optimization_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/main/source/media_optimization.cc
diff --git a/webrtc/modules/video_coding/main/source/media_optimization.cc b/webrtc/modules/video_coding/main/source/media_optimization.cc
index 327c8b4b5719048bccbf98f73c9f0c0094b75862..4c987a05132da52040326bf2d332215890a50227 100644
--- a/webrtc/modules/video_coding/main/source/media_optimization.cc
+++ b/webrtc/modules/video_coding/main/source/media_optimization.cc
@@ -204,12 +204,6 @@ uint32_t MediaOptimization::SetTargetRates(
VCMProtectionCallback* protection_callback,
VCMQMSettingsCallback* qmsettings_callback) {
CriticalSectionScoped lock(crit_sect_.get());
- // TODO(holmer): Consider putting this threshold only on the video bitrate,
- // and not on protection.
- if (max_bit_rate_ > 0 &&
- target_bitrate > static_cast<uint32_t>(max_bit_rate_)) {
- target_bitrate = max_bit_rate_;
- }
VCMProtectionMethod* selected_method = loss_prot_logic_->SelectedMethod();
float target_bitrate_kbps = static_cast<float>(target_bitrate) / 1000.0f;
loss_prot_logic_->UpdateBitRate(target_bitrate_kbps);
@@ -241,7 +235,7 @@ uint32_t MediaOptimization::SetTargetRates(
loss_prot_logic_->UpdateFilteredLossPr(packet_loss_enc);
// Rate cost of the protection methods.
- uint32_t protection_overhead_bps = 0;
+ float protection_overhead_rate = 0.0f;
// Update protection settings, when applicable.
float sent_video_rate_kbps = 0.0f;
@@ -273,15 +267,15 @@ uint32_t MediaOptimization::SetTargetRates(
// Estimate the overhead costs of the next second as staying the same
// wrt the source bitrate.
if (sent_total_rate_bps > 0) {
- protection_overhead_bps = static_cast<uint32_t>(
- target_bitrate *
- static_cast<double>(sent_nack_rate_bps + sent_fec_rate_bps) /
- sent_total_rate_bps +
- 0.5);
+ protection_overhead_rate =
+ static_cast<float>(sent_nack_rate_bps + sent_fec_rate_bps) /
+ sent_total_rate_bps;
}
+ // TODO(pbos): Does this make sense? NACK retransmissions + FEC overhead can
+ // go above 50% with FEC maxed out.
stefan-webrtc 2015/10/29 07:11:15 I don't think it does. Please remove.
pbos-webrtc 2015/10/29 16:40:42 Done.
// Cap the overhead estimate to 50%.
- if (protection_overhead_bps > target_bitrate / 2)
- protection_overhead_bps = target_bitrate / 2;
+ if (protection_overhead_rate > 0.5)
+ protection_overhead_rate = 0.5;
// Get the effective packet loss for encoder ER when applicable. Should be
// passed to encoder via fraction_lost.
@@ -290,7 +284,13 @@ uint32_t MediaOptimization::SetTargetRates(
}
// Source coding rate: total rate - protection overhead.
- target_bit_rate_ = target_bitrate - protection_overhead_bps;
+ printf("protection_overhead_bps: %f\n", protection_overhead_rate);
stefan-webrtc 2015/10/29 07:11:15 Please remove!
pbos-webrtc 2015/10/29 16:40:42 Done.
+ target_bit_rate_ = target_bitrate * (1.0 - protection_overhead_rate);
stefan-webrtc 2015/10/29 07:11:15 Name this video_target_bitrate_
pbos-webrtc 2015/10/29 16:40:42 Done.
+
+ // Cap target video bitrate to codec maximum.
+ if (max_bit_rate_ > 0 && target_bit_rate_ > max_bit_rate_) {
+ target_bit_rate_ = max_bit_rate_;
+ }
// Update encoding rates following protection settings.
float target_video_bitrate_kbps =
« no previous file with comments | « no previous file | webrtc/modules/video_coding/main/source/media_optimization_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698