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

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

Issue 2383723002: Cache the subtype of each DecoderInfo to make the Is* checks quicker. (Closed)
Patch Set: Inline IsComfortNoise, IsDtmf and IsRed in DecoderInfo. Created 4 years, 2 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 36248562bc483332917fc9f1ad4b0603f56ec6be..6fd7a396c5e1d7fb22f5c4945d447430c5379a04 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.h
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.h
@@ -65,13 +65,20 @@ class DecoderDatabase {
const SdpAudioFormat& GetFormat() const { return audio_format_; }
// Returns true if the decoder's format is comfort noise.
- bool IsComfortNoise() const;
+ bool IsComfortNoise() const {
+ RTC_DCHECK_EQ(!!cng_decoder_, subtype_ == Subtype::kComfortNoise);
+ return subtype_ == Subtype::kComfortNoise;
+ }
// Returns true if the decoder's format is DTMF.
- bool IsDtmf() const;
+ bool IsDtmf() const {
+ return subtype_ == Subtype::kDtmf;
+ }
// Returns true if the decoder's format is RED.
- bool IsRed() const;
+ bool IsRed() const {
+ return subtype_ == Subtype::kRed;
+ }
// Returns true if the decoder's format is named |name|.
bool IsType(const char* name) const;
@@ -97,6 +104,17 @@ class DecoderDatabase {
int sample_rate_hz;
};
const rtc::Optional<CngDecoder> cng_decoder_;
+
+ enum class Subtype : int8_t {
+ kNormal,
+ kComfortNoise,
+ kDtmf,
+ kRed
+ };
+
+ static Subtype SubtypeFromFormat(const SdpAudioFormat& format);
+
+ const Subtype subtype_;
};
// 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