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

Unified Diff: webrtc/video/video_send_stream.cc

Issue 1972083002: Move logic for calculating needed bitrate overhead used by NACK and FEC to VideoSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed video_sender_unittest for now. Created 4 years, 7 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
Index: webrtc/video/video_send_stream.cc
diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc
index 95552704b8fc9bb522caf7b9197f354fc01f93e6..ce0cf589358bb273ff7c16454ed88b2302de3430 100644
--- a/webrtc/video/video_send_stream.cc
+++ b/webrtc/video/video_send_stream.cc
@@ -383,6 +383,7 @@ VideoSendStream::VideoSendStream(
encoder_feedback_(Clock::GetRealTimeClock(),
config.rtp.ssrcs,
&vie_encoder_),
+ post_encode_protection_(Clock::GetRealTimeClock(), this),
video_sender_(vie_encoder_.video_sender()),
bandwidth_observer_(congestion_controller_->GetBitrateController()
->CreateRtcpBandwidthObserver()),
@@ -417,8 +418,6 @@ VideoSendStream::VideoSendStream(
congestion_controller_->packet_router()->AddRtpModule(rtp_rtcp);
}
- video_sender_->RegisterProtectionCallback(this);
-
for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
const std::string& extension = config_.rtp.extensions[i].name;
int id = config_.rtp.extensions[i].id;
@@ -566,6 +565,13 @@ void VideoSendStream::EncoderProcess() {
stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]);
}
+ post_encode_protection_.SetEncodingData(
+ encoder_settings->video_codec.startBitrate * 1000,
+ encoder_settings->video_codec.width,
+ encoder_settings->video_codec.height,
+ encoder_settings->video_codec.maxFramerate,
+ encoder_settings->streams.size(), payload_router_.MaxPayloadLength());
stefan-webrtc 2016/05/19 12:52:40 num_layers should be the number of temporal layers
perkj_webrtc 2016/06/01 20:55:23 Done.
+
// We might've gotten new settings while configuring the encoder settings,
// restart from the top to see if that's the case before trying to encode
// a frame (which might correspond to the last frame size).
@@ -622,6 +628,7 @@ int32_t VideoSendStream::Encoded(const EncodedImage& encoded_image,
// |encoded_frame_proxy_| forwards frames to |config_.post_encode_callback|;
encoded_frame_proxy_.Encoded(encoded_image, codec_specific_info,
fragmentation);
+ post_encode_protection_.UpdateWithEncodedData(encoded_image);
int32_t return_value = payload_router_.Encoded(
encoded_image, codec_specific_info, fragmentation);
@@ -701,8 +708,8 @@ void VideoSendStream::ConfigureProtection() {
}
}
- vie_encoder_.SetProtectionMethod(enable_protection_nack,
- enable_protection_fec);
+ post_encode_protection_.SetProtectionMethod(enable_protection_fec,
+ enable_protection_nack);
}
void VideoSendStream::ConfigureSsrcs() {
@@ -780,7 +787,12 @@ void VideoSendStream::OnBitrateUpdated(uint32_t bitrate_bps,
uint8_t fraction_loss,
int64_t rtt) {
payload_router_.SetTargetSendBitrate(bitrate_bps);
- vie_encoder_.OnBitrateUpdated(bitrate_bps, fraction_loss, rtt);
+ // Get the encoder target rate. It is the estimated network rate -
+ // protection overhead.
+ uint32_t encoder_target_rate =
+ post_encode_protection_.SetTargetRates(bitrate_bps, fraction_loss, rtt);
+
+ vie_encoder_.OnBitrateUpdated(encoder_target_rate, fraction_loss, rtt);
}
int VideoSendStream::ProtectionRequest(const FecProtectionParams* delta_params,

Powered by Google App Engine
This is Rietveld 408576698