Index: webrtc/modules/audio_coding/acm2/acm_receiver.cc |
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc |
index 89eee00fc37edc10d715f1720ff193688d863b8d..2589bb8d25c2c1d0c247d3b8ee930d22a4a3114a 100644 |
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc |
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.cc |
@@ -98,6 +98,8 @@ int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header, |
} |
} else { |
last_audio_decoder_ = ci; |
+ last_audio_format_ = neteq_->GetDecoderFormat(ci->pltype); |
+ RTC_DCHECK(last_audio_format_); |
last_packet_sample_rate_hz_ = rtc::Optional<int>(ci->plfreq); |
} |
@@ -238,6 +240,7 @@ void AcmReceiver::RemoveAllCodecs() { |
rtc::CritScope lock(&crit_sect_); |
neteq_->RemoveAllPayloadTypes(); |
last_audio_decoder_ = rtc::Optional<CodecInst>(); |
+ last_audio_format_ = rtc::Optional<SdpAudioFormat>(); |
last_packet_sample_rate_hz_ = rtc::Optional<int>(); |
} |
@@ -250,6 +253,7 @@ int AcmReceiver::RemoveCodec(uint8_t payload_type) { |
} |
if (last_audio_decoder_ && payload_type == last_audio_decoder_->pltype) { |
last_audio_decoder_ = rtc::Optional<CodecInst>(); |
+ last_audio_format_ = rtc::Optional<SdpAudioFormat>(); |
last_packet_sample_rate_hz_ = rtc::Optional<int>(); |
} |
return 0; |
@@ -272,6 +276,11 @@ int AcmReceiver::LastAudioCodec(CodecInst* codec) const { |
return 0; |
} |
+rtc::Optional<SdpAudioFormat> AcmReceiver::LastAudioFormat() const { |
+ rtc::CritScope lock(&crit_sect_); |
+ return last_audio_format_; |
+} |
+ |
void AcmReceiver::GetNetworkStatistics(NetworkStatistics* acm_stat) { |
NetEqNetworkStatistics neteq_stat; |
// NetEq function always returns zero, so we don't check the return value. |