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 <nisse@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20121}
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index 997c95e..62620a4 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -106,7 +106,6 @@
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 @@
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() {