Index: webrtc/video/video_receive_stream.cc |
diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc |
index 174d35256493ce4d166c6e20c59c0ab40eae629c..9ebfc7de95b5295766bf16fd75b76fe924ad3dca 100644 |
--- a/webrtc/video/video_receive_stream.cc |
+++ b/webrtc/video/video_receive_stream.cc |
@@ -19,6 +19,7 @@ |
#include "webrtc/base/checks.h" |
#include "webrtc/base/logging.h" |
#include "webrtc/base/optional.h" |
+#include "webrtc/call/flexfec_receive_stream.h" |
#include "webrtc/common_video/h264/profile_level_id.h" |
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
#include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
@@ -194,7 +195,8 @@ VideoReceiveStream::VideoReceiveStream( |
webrtc::VoiceEngine* voice_engine, |
ProcessThread* process_thread, |
CallStats* call_stats, |
- VieRemb* remb) |
+ VieRemb* remb, |
+ FlexfecProtectionMediator* flexfec_protection_mediator) |
: transport_adapter_(config.rtcp_send_transport), |
config_(std::move(config)), |
num_cpu_cores_(num_cpu_cores), |
@@ -203,6 +205,7 @@ VideoReceiveStream::VideoReceiveStream( |
decode_thread_(DecodeThreadFunction, this, "DecodingThread"), |
congestion_controller_(congestion_controller), |
call_stats_(call_stats), |
+ flexfec_protection_mediator_(flexfec_protection_mediator), |
timing_(new VCMTiming(clock_)), |
video_receiver_(clock_, nullptr, this, timing_.get(), this, this), |
stats_proxy_(&config_, clock_), |
@@ -288,12 +291,14 @@ bool VideoReceiveStream::OnRecoveredPacket(const uint8_t* packet, |
void VideoReceiveStream::Start() { |
if (decode_thread_.IsRunning()) |
return; |
+ |
+ bool fec_enabled = IsFlexfecEnabled() || IsUlpfecEnabled(); |
+ |
if (jitter_buffer_experiment_) { |
frame_buffer_->Start(); |
call_stats_->RegisterStatsObserver(&rtp_stream_receiver_); |
- if (rtp_stream_receiver_.IsRetransmissionsEnabled() && |
- rtp_stream_receiver_.IsUlpfecEnabled()) { |
+ if (rtp_stream_receiver_.IsRetransmissionsEnabled() && fec_enabled) { |
frame_buffer_->SetProtectionMode(kProtectionNackFEC); |
} |
} |
@@ -323,9 +328,8 @@ void VideoReceiveStream::Start() { |
video_stream_decoder_.reset(new VideoStreamDecoder( |
&video_receiver_, &rtp_stream_receiver_, &rtp_stream_receiver_, |
- rtp_stream_receiver_.IsRetransmissionsEnabled(), |
- rtp_stream_receiver_.IsUlpfecEnabled(), &stats_proxy_, renderer, |
- config_.pre_render_callback)); |
+ rtp_stream_receiver_.IsRetransmissionsEnabled(), fec_enabled, |
+ &stats_proxy_, renderer, config_.pre_render_callback)); |
// Register the channel to receive stats updates. |
call_stats_->RegisterStatsObserver(video_stream_decoder_.get()); |
// Start the decode thread |
@@ -490,5 +494,14 @@ void VideoReceiveStream::RequestKeyFrame() { |
rtp_stream_receiver_.RequestKeyFrame(); |
} |
+bool VideoReceiveStream::IsFlexfecEnabled() const { |
+ return flexfec_protection_mediator_->IsProtectedByFlexfec( |
+ config_.rtp.remote_ssrc); |
+} |
+ |
+bool VideoReceiveStream::IsUlpfecEnabled() const { |
+ return rtp_stream_receiver_.IsUlpfecEnabled(); |
+} |
+ |
} // namespace internal |
} // namespace webrtc |