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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 NetEqDecoder codec_type) const { 162 NetEqDecoder codec_type) const {
163 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type); 163 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type);
164 if (it == decoders_.end()) { 164 if (it == decoders_.end()) {
165 // Decoder not found. 165 // Decoder not found.
166 return false; 166 return false;
167 } 167 }
168 return ((*it).second.codec_type == codec_type); 168 return ((*it).second.codec_type == codec_type);
169 } 169 }
170 170
171 bool DecoderDatabase::IsComfortNoise(uint8_t rtp_payload_type) const { 171 bool DecoderDatabase::IsComfortNoise(uint8_t rtp_payload_type) const {
172 if (IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGnb) || 172 DecoderMap::const_iterator it = decoders_.find(rtp_payload_type);
173 IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGwb) || 173 if (it == decoders_.end()) {
174 IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGswb32kHz) || 174 // Decoder not found.
175 IsType(rtp_payload_type, NetEqDecoder::kDecoderCNGswb48kHz)) {
176 return true;
177 } else {
178 return false; 175 return false;
179 } 176 }
kwiberg-webrtc 2016/04/27 12:16:34 Suggestion for future improvement: If we're having
177 const auto& type = it->second.codec_type;
178 return type == NetEqDecoder::kDecoderCNGnb
179 || type == NetEqDecoder::kDecoderCNGwb
180 || type == NetEqDecoder::kDecoderCNGswb32kHz
181 || type == NetEqDecoder::kDecoderCNGswb48kHz;
180 } 182 }
181 183
182 bool DecoderDatabase::IsDtmf(uint8_t rtp_payload_type) const { 184 bool DecoderDatabase::IsDtmf(uint8_t rtp_payload_type) const {
183 return IsType(rtp_payload_type, NetEqDecoder::kDecoderAVT); 185 return IsType(rtp_payload_type, NetEqDecoder::kDecoderAVT);
184 } 186 }
185 187
186 bool DecoderDatabase::IsRed(uint8_t rtp_payload_type) const { 188 bool DecoderDatabase::IsRed(uint8_t rtp_payload_type) const {
187 return IsType(rtp_payload_type, NetEqDecoder::kDecoderRED); 189 return IsType(rtp_payload_type, NetEqDecoder::kDecoderRED);
188 } 190 }
189 191
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type " 269 LOG(LS_WARNING) << "CheckPayloadTypes: unknown RTP payload type "
268 << static_cast<int>((*it)->header.payloadType); 270 << static_cast<int>((*it)->header.payloadType);
269 return kDecoderNotFound; 271 return kDecoderNotFound;
270 } 272 }
271 } 273 }
272 return kOK; 274 return kOK;
273 } 275 }
274 276
275 277
276 } // namespace webrtc 278 } // namespace webrtc
OLDNEW
« 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