Index: webrtc/media/engine/webrtcvideoengine.cc |
diff --git a/webrtc/media/engine/webrtcvideoengine.cc b/webrtc/media/engine/webrtcvideoengine.cc |
index e592740bb9260b3c6594514930a1793dca4c96af..1662772aab43f3903d3219444aa6972ebce9bad3 100644 |
--- a/webrtc/media/engine/webrtcvideoengine.cc |
+++ b/webrtc/media/engine/webrtcvideoengine.cc |
@@ -2177,6 +2177,7 @@ WebRtcVideoChannel::WebRtcVideoReceiveStream::AllocatedDecoder:: |
WebRtcVideoChannel::WebRtcVideoReceiveStream::~WebRtcVideoReceiveStream() { |
if (flexfec_stream_) { |
+ MaybeDissociateFlexfecFromVideo(); |
call_->DestroyFlexfecReceiveStream(flexfec_stream_); |
} |
call_->DestroyVideoReceiveStream(stream_); |
@@ -2357,24 +2358,42 @@ void WebRtcVideoChannel::WebRtcVideoReceiveStream::SetRecvParameters( |
void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
RecreateWebRtcVideoStream() { |
if (stream_) { |
+ MaybeDissociateFlexfecFromVideo(); |
call_->DestroyVideoReceiveStream(stream_); |
stream_ = nullptr; |
} |
webrtc::VideoReceiveStream::Config config = config_.Copy(); |
config.rtp.protected_by_flexfec = (flexfec_stream_ != nullptr); |
stream_ = call_->CreateVideoReceiveStream(std::move(config)); |
+ MaybeAssociateFlexfecFromVideo(); |
stream_->Start(); |
} |
void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
MaybeRecreateWebRtcFlexfecStream() { |
if (flexfec_stream_) { |
+ MaybeDissociateFlexfecFromVideo(); |
call_->DestroyFlexfecReceiveStream(flexfec_stream_); |
flexfec_stream_ = nullptr; |
} |
if (flexfec_config_.IsCompleteAndEnabled()) { |
flexfec_stream_ = call_->CreateFlexfecReceiveStream(flexfec_config_); |
flexfec_stream_->Start(); |
+ MaybeAssociateFlexfecFromVideo(); |
+ } |
+} |
+ |
+void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
+ MaybeAssociateFlexfecFromVideo() { |
+ if (stream_ && flexfec_stream_) { |
+ stream_->AddSecondarySink(flexfec_stream_); |
+ } |
+} |
+ |
+void WebRtcVideoChannel::WebRtcVideoReceiveStream:: |
+ MaybeDissociateFlexfecFromVideo() { |
+ if (stream_ && flexfec_stream_) { |
+ stream_->RemoveSecondarySink(flexfec_stream_); |
} |
} |