Fix race in DegradedCall::DestroyVideoSendStream

VideoSendStream might call SendRtp or SendRtcp asynchronously (for
instance periodic RTCP messages), so we must destroy the VideoSendStream
before FakeNetworkPipe, otherwise might crash in DegradedCall::SendRtcp.

Bug: webrtc:8910
Change-Id: I18e76c40a5213bd7378a39acba100edd9e2a193b
Reviewed-on: https://webrtc-review.googlesource.com/62341
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22468}
This commit is contained in:
Erik Språng 2018-03-16 10:47:16 +01:00 committed by Commit Bot
parent 883d00f7d1
commit eef09fc42d

View File

@ -94,6 +94,7 @@ VideoSendStream* DegradedCall::CreateVideoSendStream(
}
void DegradedCall::DestroyVideoSendStream(VideoSendStream* send_stream) {
call_->DestroyVideoSendStream(send_stream);
if (send_pipe_ && num_send_streams_ > 0) {
--num_send_streams_;
if (num_send_streams_ == 0) {
@ -101,7 +102,6 @@ void DegradedCall::DestroyVideoSendStream(VideoSendStream* send_stream) {
send_pipe_.reset();
}
}
call_->DestroyVideoSendStream(send_stream);
}
VideoReceiveStream* DegradedCall::CreateVideoReceiveStream(