Index: webrtc/voice_engine/channel.cc |
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc |
index 1d54821a50c882d1e85a7426295948c475333f0b..b4b11ee7eb076b4c4d1ff7b51c9740bd131a875b 100644 |
--- a/webrtc/voice_engine/channel.cc |
+++ b/webrtc/voice_engine/channel.cc |
@@ -2778,23 +2778,27 @@ void Channel::SetRtcpRttStats(RtcpRttStats* rtcp_rtt_stats) { |
rtcp_rtt_stats_proxy_->SetRtcpRttStats(rtcp_rtt_stats); |
} |
-void Channel::UpdateOverheadForEncoder() { |
+void Channel::UpdateOverheadForEncoder(size_t overhead_per_packet) { |
audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
if (*encoder) { |
- (*encoder)->OnReceivedOverhead(transport_overhead_per_packet_ + |
- rtp_overhead_per_packet_); |
+ (*encoder)->OnReceivedOverhead(overhead_per_packet); |
} |
}); |
} |
+// TODO(solenberg): Make AudioSendStream an OverheadObserver instead. |
void Channel::SetTransportOverhead(size_t transport_overhead_per_packet) { |
+ rtc::CritScope cs(&overhead_per_packet_lock_); |
transport_overhead_per_packet_ = transport_overhead_per_packet; |
- UpdateOverheadForEncoder(); |
+ UpdateOverheadForEncoder(transport_overhead_per_packet_ + |
+ rtp_overhead_per_packet_); |
} |
void Channel::OnOverheadChanged(size_t overhead_bytes_per_packet) { |
+ rtc::CritScope cs(&overhead_per_packet_lock_); |
rtp_overhead_per_packet_ = overhead_bytes_per_packet; |
- UpdateOverheadForEncoder(); |
+ UpdateOverheadForEncoder(transport_overhead_per_packet_ + |
+ rtp_overhead_per_packet_); |
} |
int Channel::GetNetworkStatistics(NetworkStatistics& stats) { |