if (audio_configured_) {
return max_payload_length_ - RTPHeaderLength();
} else {
- return max_payload_length_ - RTPHeaderLength() -
- video_->FECPacketOverhead() - ((rtx_) ? 2 : 0);
- // Include the FEC/ULP/RED overhead.
+ return max_payload_length_ - RTPHeaderLength() // RTP overhead.
+ - video_->FECPacketOverhead() // FEC/ULP/RED overhead.
+ - ((rtx_) ? 2 : 0); // RTX overhead.
}
}
const RTPHeader& header,
bool is_rtx,
bool is_retransmit) {
- CriticalSectionScoped lock(statistics_crit_.get());
StreamDataCounters* counters;
- uint32_t ssrc;
+ // Get ssrc before taking statistics_crit_ to avoid possible deadlock.
+ uint32_t ssrc = SSRC();
+
+ CriticalSectionScoped lock(statistics_crit_.get());
if (is_rtx) {
counters = &rtx_rtp_stats_;
ssrc = ssrc_rtx_;
} else {
counters = &rtp_stats_;
- ssrc = ssrc_;
}
bitrate_sent_.Update(size);