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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2339953002: AcmReceiver: Look up last decoder in NetEq's table of decoders (Closed)
Patch Set: Created 4 years, 3 months 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/neteq/neteq_impl.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 9c4f5809068f8964ef74882c0414f184ce37eef0..71eea2114c2d3892e13d160ba43d8e700e20dea7 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -431,6 +431,27 @@ int NetEqImpl::last_output_sample_rate_hz() const {
return last_output_sample_rate_hz_;
}
+rtc::Optional<CodecInst> NetEqImpl::GetDecoder(int payload_type) const {
+ rtc::CritScope lock(&crit_sect_);
+ const DecoderDatabase::DecoderInfo* di =
+ decoder_database_->GetDecoderInfo(payload_type);
+ if (!di) {
+ return rtc::Optional<CodecInst>();
+ }
+
+ // Create a CodecInst with some fields set. The remaining fields are zeroed,
+ // but we tell MSan to consider them uninitialized.
+ CodecInst ci = {0};
+ rtc::MsanMarkUninitialized(rtc::MakeArrayView(&ci, 1));
+ ci.pltype = payload_type;
+ std::strncpy(ci.plname, di->name.c_str(), sizeof(ci.plname));
+ ci.plname[sizeof(ci.plname) - 1] = '\0';
+ ci.plfreq = di->IsRed() || di->IsDtmf() ? 8000 : di->SampleRateHz();
ossu 2016/09/16 11:39:32 This looks like a place where something might go w
kwiberg-webrtc 2016/09/16 11:50:38 It sounds like my best strategy is to land this qu
ossu 2016/09/16 11:55:59 Hmm. I think di->GetFormat().clockrate_hz instead
kwiberg-webrtc 2016/09/16 12:04:20 No, because (1) that's the RTP timestamp rate, not
ossu 2016/09/16 12:10:06 Yes, but for DTMF the clockrate == sample rate, so
+ AudioDecoder* const decoder = di->GetDecoder();
+ ci.channels = decoder ? decoder->Channels() : 1;
+ return rtc::Optional<CodecInst>(ci);
+}
+
int NetEqImpl::SetTargetNumberOfChannels() {
return kNotImplemented;
}

Powered by Google App Engine
This is Rietveld 408576698