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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/decoder_database.cc » ('j') | 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // Set iff this is an external decoder. 91 // Set iff this is an external decoder.
92 AudioDecoder* const external_decoder_; 92 AudioDecoder* const external_decoder_;
93 93
94 // Set iff this is a comfort noise decoder. 94 // Set iff this is a comfort noise decoder.
95 struct CngDecoder { 95 struct CngDecoder {
96 static rtc::Optional<CngDecoder> Create(const SdpAudioFormat& format); 96 static rtc::Optional<CngDecoder> Create(const SdpAudioFormat& format);
97 int sample_rate_hz; 97 int sample_rate_hz;
98 }; 98 };
99 const rtc::Optional<CngDecoder> cng_decoder_; 99 const rtc::Optional<CngDecoder> cng_decoder_;
100
101 enum class Subtype {
102 kNormal,
103 kComfortNoise,
104 kDtmf,
105 kRed
106 };
kwiberg-webrtc 2016/09/30 11:28:24 Do you have to tell the compiler to store this in
ossu 2016/09/30 11:36:47 According to a quick look-on-the-internet, enum cl
kwiberg-webrtc 2016/09/30 11:45:37 Look at it this way: reading and writing 1 byte is
ossu 2016/09/30 11:50:34 Just the other day I was asked to change two uint8
kwiberg-webrtc 2016/09/30 13:05:27 The reason we prefer int for integers rather than
ossu 2016/09/30 13:45:21 Alright. I've turned it into an int8_t and a quick
kwiberg-webrtc 2016/09/30 16:55:00 Wohoo! That's the best kind of improvement, right?
107
108 static Subtype SubtypeFromFormat(const SdpAudioFormat& format);
109
110 const Subtype subtype_;
100 }; 111 };
101 112
102 // Maximum value for 8 bits, and an invalid RTP payload type (since it is 113 // Maximum value for 8 bits, and an invalid RTP payload type (since it is
103 // only 7 bits). 114 // only 7 bits).
104 static const uint8_t kRtpPayloadTypeError = 0xFF; 115 static const uint8_t kRtpPayloadTypeError = 0xFF;
105 116
106 DecoderDatabase( 117 DecoderDatabase(
107 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory); 118 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
108 119
109 virtual ~DecoderDatabase(); 120 virtual ~DecoderDatabase();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 int active_decoder_type_; 208 int active_decoder_type_;
198 int active_cng_decoder_type_; 209 int active_cng_decoder_type_;
199 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_; 210 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_;
200 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; 211 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
201 212
202 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); 213 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase);
203 }; 214 };
204 215
205 } // namespace webrtc 216 } // namespace webrtc
206 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ 217 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
OLDNEW
« 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