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}
This commit is contained in:
Danil Chapovalov 2017-10-03 14:59:27 +02:00 committed by Commit Bot
parent c3fa8e1ce7
commit 90e1f539a5

View File

@ -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() {