Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: webrtc/modules/audio_coding/main/acm2/acm_receiver.cc

Issue 1467183002: Add new method AcmReceiver::last_packet_sample_rate_hz() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-last-output-rate
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
diff --git a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
index 17750291dad5ed15c675ea4f2ab27124f08ed27f..c441827600a5d66edc5fc9858c64717afd3b7849 100644
--- a/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/main/acm2/acm_receiver.cc
@@ -128,7 +128,8 @@ AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config)
neteq_(NetEq::Create(config.neteq_config)),
vad_enabled_(config.neteq_config.enable_post_decode_vad),
clock_(config.clock),
- resampled_last_output_frame_(true) {
+ resampled_last_output_frame_(true),
+ last_packet_sample_rate_hz_() {
kwiberg-webrtc 2015/11/23 13:03:50 No need to call the default constructor explicitly
hlundin-webrtc 2015/11/23 13:50:45 Done.
assert(clock_);
memset(audio_buffer_.get(), 0, AudioFrame::kMaxDataSizeSamples);
memset(last_audio_buffer_.get(), 0, AudioFrame::kMaxDataSizeSamples);
@@ -156,6 +157,11 @@ int AcmReceiver::LeastRequiredDelayMs() const {
return neteq_->LeastRequiredDelayMs();
}
+rtc::Optional<int> AcmReceiver::last_packet_sample_rate_hz() const {
+ CriticalSectionScoped lock(crit_sect_.get());
+ return last_packet_sample_rate_hz_;
+}
+
int AcmReceiver::last_output_sample_rate_hz() const {
return neteq_->last_output_sample_rate_hz();
}
@@ -190,6 +196,7 @@ int AcmReceiver::InsertPacket(const WebRtcRTPHeader& rtp_header,
decoder->acm_codec_id !=
*RentACodec::CodecIndexFromId(RentACodec::CodecId::kAVT)) {
last_audio_decoder_ = decoder;
+ last_packet_sample_rate_hz_ = rtc::Optional<int>(decoder->sample_rate_hz);
}
} // |crit_sect_| is released.
@@ -392,6 +399,7 @@ int AcmReceiver::RemoveAllCodecs() {
// No codec is registered, invalidate last audio decoder.
last_audio_decoder_ = nullptr;
+ last_packet_sample_rate_hz_ = rtc::Optional<int>();
return ret_val;
}
@@ -405,8 +413,10 @@ int AcmReceiver::RemoveCodec(uint8_t payload_type) {
LOG(LERROR) << "AcmReceiver::RemoveCodec" << static_cast<int>(payload_type);
return -1;
}
- if (last_audio_decoder_ == &it->second)
+ if (last_audio_decoder_ == &it->second) {
last_audio_decoder_ = nullptr;
+ last_packet_sample_rate_hz_ = rtc::Optional<int>();
+ }
decoders_.erase(it);
return 0;
}
@@ -420,11 +430,6 @@ bool AcmReceiver::GetPlayoutTimestamp(uint32_t* timestamp) {
return neteq_->GetPlayoutTimestamp(timestamp);
}
-int AcmReceiver::last_audio_codec_id() const {
- CriticalSectionScoped lock(crit_sect_.get());
- return last_audio_decoder_ ? last_audio_decoder_->acm_codec_id : -1;
-}
-
int AcmReceiver::LastAudioCodec(CodecInst* codec) const {
CriticalSectionScoped lock(crit_sect_.get());
if (!last_audio_decoder_) {

Powered by Google App Engine
This is Rietveld 408576698