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

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

Issue 1899733002: NetEq: Simplify DecoderDatabase::DecoderInfo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review comments 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/decoder_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/decoder_database.h
diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.h b/webrtc/modules/audio_coding/neteq/decoder_database.h
index 01ff0c9fdb365fcccc24153352d352fbcc79ff2f..3706b9025d0320b283981b36da82a63d67809c3c 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.h
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.h
@@ -34,30 +34,31 @@ class DecoderDatabase {
kInvalidPointer = -6
};
- // Struct used to store decoder info in the database.
- struct DecoderInfo {
- DecoderInfo() = default;
- DecoderInfo(NetEqDecoder ct, int fs, AudioDecoder* dec, bool ext)
- : DecoderInfo(ct, "", fs, dec, ext) {}
+ // Class that stores decoder info in the database.
+ class DecoderInfo {
+ public:
DecoderInfo(NetEqDecoder ct,
const std::string& nm,
int fs,
- AudioDecoder* dec,
- bool ext)
- : codec_type(ct),
- name(nm),
- fs_hz(fs),
- rtp_sample_rate_hz(fs),
- decoder(dec),
- external(ext) {}
+ AudioDecoder* ext_dec);
+ DecoderInfo(DecoderInfo&&);
~DecoderInfo();
- NetEqDecoder codec_type = NetEqDecoder::kDecoderArbitrary;
- std::string name;
- int fs_hz = 8000;
- int rtp_sample_rate_hz = 8000;
- AudioDecoder* decoder = nullptr;
- bool external = false;
+ // Get the AudioDecoder object, creating it first if necessary.
+ AudioDecoder* GetDecoder();
+
+ // Delete the AudioDecoder object, unless it's external. (This means we can
+ // always recreate it later if we need it.)
+ void DropDecoder() { decoder_.reset(); }
+
+ const NetEqDecoder codec_type;
+ const std::string name;
+ const int fs_hz;
+ const int rtp_sample_rate_hz;
+ AudioDecoder* const external_decoder;
+
+ private:
+ std::unique_ptr<AudioDecoder> decoder_;
};
// Maximum value for 8 bits, and an invalid RTP payload type (since it is
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/decoder_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698