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

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

Issue 1923763003: DecoderDatabase::IsComfortNoise: Improved efficiency. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cng-experiment
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c163bbdbf3d5ad862470e299f741729ffbc4f518..845b2adaef7071ae040978d2d9efa76904c252a1 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.cc
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.cc
@@ -169,14 +169,16 @@ bool DecoderDatabase::IsType(uint8_t rtp_payload_type,
}
bool DecoderDatabase::IsComfortNoise(uint8_t rtp_payload_type) const {
- if (IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGnb) ||
- IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGwb) ||
- IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGswb32kHz) ||
- IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGswb48kHz)) {
- return true;
- } else {
+ DecoderMap::const_iterator it = decoders_.find(rtp_payload_type);
+ if (it == decoders_.end()) {
+ // Decoder not found.
return false;
}
kwiberg-webrtc 2016/04/27 12:16:34 Suggestion for future improvement: If we're having
+ const auto& type = it->second.codec_type;
+ return type == NetEqDecoder::kDecoderCNGnb
+ || type == NetEqDecoder::kDecoderCNGwb
+ || type == NetEqDecoder::kDecoderCNGswb32kHz
+ || type == NetEqDecoder::kDecoderCNGswb48kHz;
}
bool DecoderDatabase::IsDtmf(uint8_t rtp_payload_type) const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698