From 90e1f539a5fc0e081720a424b9acd54cbcb08b62 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Tue, 3 Oct 2017 14:59:27 +0200 Subject: [PATCH] Fix potentional race in AudioSendStream constructor RegisterPacketFeedbackObserver signals congestion controller object is ready to process incoming packet, thus call it as last statement in the constructor Bug: webrtc:8325 Change-Id: I31d8ab04c568e639db12c97b649c2d50a489ce24 Reviewed-on: https://webrtc-review.googlesource.com/5860 Reviewed-by: Niels Moller Reviewed-by: Fredrik Solenberg Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#20121} --- audio/audio_send_stream.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc index 997c95edb5..62620a44f2 100644 --- a/audio/audio_send_stream.cc +++ b/audio/audio_send_stream.cc @@ -106,7 +106,6 @@ AudioSendStream::AudioSendStream( channel_proxy_->SetRtcEventLog(event_log_); channel_proxy_->SetRtcpRttStats(rtcp_rtt_stats); channel_proxy_->SetRTCPStatus(true); - transport_->send_side_cc()->RegisterPacketFeedbackObserver(this); RtpReceiver* rtpReceiver = nullptr; // Unused, but required for call. channel_proxy_->GetRtpRtcp(&rtp_rtcp_module_, &rtpReceiver); RTC_DCHECK(rtp_rtcp_module_); @@ -114,6 +113,8 @@ AudioSendStream::AudioSendStream( ConfigureStream(this, config, true); pacer_thread_checker_.DetachFromThread(); + // Signal congestion controller this object is ready for OnPacket* callbacks. + transport_->send_side_cc()->RegisterPacketFeedbackObserver(this); } AudioSendStream::~AudioSendStream() {