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

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

Issue 1928293002: NetEq: Use a BuiltinAudioDecoderFactory to create decoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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/decoder_database.cc
diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.cc b/webrtc/modules/audio_coding/neteq/decoder_database.cc
index 845b2adaef7071ae040978d2d9efa76904c252a1..e5f3de4fd663d2c92bfaf956b8a201fefc894bdb 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.cc
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.cc
@@ -19,9 +19,11 @@
namespace webrtc {
-DecoderDatabase::DecoderDatabase()
- : active_decoder_type_(-1), active_cng_decoder_type_(-1) {
-}
+DecoderDatabase::DecoderDatabase(
+ std::unique_ptr<AudioDecoderFactory> decoder_factory)
+ : active_decoder_type_(-1),
+ active_cng_decoder_type_(-1),
+ decoder_factory_(std::move(decoder_factory)) {}
DecoderDatabase::~DecoderDatabase() = default;
@@ -32,20 +34,22 @@ DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct,
: codec_type(ct),
name(nm),
fs_hz(fs),
- external_decoder(ext_dec) {}
+ external_decoder(ext_dec),
+ audio_format_(acm2::RentACodec::NetEqDecoderToSdpAudioFormat(ct)) {}
DecoderDatabase::DecoderInfo::DecoderInfo(DecoderInfo&&) = default;
DecoderDatabase::DecoderInfo::~DecoderInfo() = default;
-AudioDecoder* DecoderDatabase::DecoderInfo::GetDecoder() {
+AudioDecoder* DecoderDatabase::DecoderInfo::GetDecoder(
+ AudioDecoderFactory* factory) {
if (external_decoder) {
RTC_DCHECK(!decoder_);
return external_decoder;
}
- if (!decoder_) {
- decoder_.reset(CreateAudioDecoder(codec_type));
+ if (!decoder_ && audio_format_) {
+ decoder_ = factory->MakeAudioDecoder(*audio_format_);
+ RTC_DCHECK(decoder_) << "Failed to create: " << *audio_format_;
}
- RTC_DCHECK(decoder_);
return decoder_.get();
hlundin-webrtc 2016/04/29 11:52:56 So now we can end up returning no decoder without
kwiberg-webrtc 2016/04/29 23:10:13 I... ummm... oh, look over there! A pink elephant!
hlundin-webrtc 2016/05/02 07:54:42 Where? What!?
}
@@ -155,7 +159,7 @@ AudioDecoder* DecoderDatabase::GetDecoder(uint8_t rtp_payload_type) {
return NULL;
}
DecoderInfo* info = &(*it).second;
- return info->GetDecoder();
+ return info->GetDecoder(decoder_factory_.get());
}
bool DecoderDatabase::IsType(uint8_t rtp_payload_type,

Powered by Google App Engine
This is Rietveld 408576698