DecoderDatabase::IsComfortNoise: Improved efficiency.
Changed DecoderDatabase::IsComfortNoise to do one, rather than four, lookups of the rtp payload type. IsComfortNoise is called more frequently since CNG was changed to not be an AudioDecoder. BUG=606765 Review URL: https://codereview.webrtc.org/1923763003 Cr-Commit-Position: refs/heads/master@{#12533}
This commit is contained in:
@ -169,14 +169,16 @@ bool DecoderDatabase::IsType(uint8_t rtp_payload_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DecoderDatabase::IsComfortNoise(uint8_t rtp_payload_type) const {
|
bool DecoderDatabase::IsComfortNoise(uint8_t rtp_payload_type) const {
|
||||||
if (IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGnb) ||
|
DecoderMap::const_iterator it = decoders_.find(rtp_payload_type);
|
||||||
IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGwb) ||
|
if (it == decoders_.end()) {
|
||||||
IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGswb32kHz) ||
|
// Decoder not found.
|
||||||
IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGswb48kHz)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
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 {
|
bool DecoderDatabase::IsDtmf(uint8_t rtp_payload_type) const {
|
||||||
|
|||||||
Reference in New Issue
Block a user