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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decoder_database.h

Issue 2472083002: NetEq: Don't forget to save the codec name (Closed)
Patch Set: Created 4 years, 1 month 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
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 23 matching lines...) Expand all
34 kCodecNotSupported = -2, 34 kCodecNotSupported = -2,
35 kInvalidSampleRate = -3, 35 kInvalidSampleRate = -3,
36 kDecoderExists = -4, 36 kDecoderExists = -4,
37 kDecoderNotFound = -5, 37 kDecoderNotFound = -5,
38 kInvalidPointer = -6 38 kInvalidPointer = -6
39 }; 39 };
40 40
41 // Class that stores decoder info in the database. 41 // Class that stores decoder info in the database.
42 class DecoderInfo { 42 class DecoderInfo {
43 public: 43 public:
44 DecoderInfo(const SdpAudioFormat& audio_format,
45 AudioDecoderFactory* factory,
46 const std::string& codec_name);
44 explicit DecoderInfo(const SdpAudioFormat& audio_format, 47 explicit DecoderInfo(const SdpAudioFormat& audio_format,
45 AudioDecoderFactory* factory = nullptr); 48 AudioDecoderFactory* factory = nullptr);
46 explicit DecoderInfo(NetEqDecoder ct, 49 explicit DecoderInfo(NetEqDecoder ct,
47 AudioDecoderFactory* factory = nullptr); 50 AudioDecoderFactory* factory = nullptr);
48 DecoderInfo(const SdpAudioFormat& audio_format, AudioDecoder* ext_dec); 51 DecoderInfo(const SdpAudioFormat& audio_format,
52 AudioDecoder* ext_dec,
53 const std::string& codec_name);
49 DecoderInfo(DecoderInfo&&); 54 DecoderInfo(DecoderInfo&&);
50 ~DecoderInfo(); 55 ~DecoderInfo();
51 56
52 // Get the AudioDecoder object, creating it first if necessary. 57 // Get the AudioDecoder object, creating it first if necessary.
53 AudioDecoder* GetDecoder() const; 58 AudioDecoder* GetDecoder() const;
54 59
55 // Delete the AudioDecoder object, unless it's external. (This means we can 60 // Delete the AudioDecoder object, unless it's external. (This means we can
56 // always recreate it later if we need it.) 61 // always recreate it later if we need it.)
57 void DropDecoder() const { decoder_.reset(); } 62 void DropDecoder() const { decoder_.reset(); }
58 63
(...skipping 19 matching lines...) Expand all
78 // Returns true if the decoder's format is RED. 83 // Returns true if the decoder's format is RED.
79 bool IsRed() const { 84 bool IsRed() const {
80 return subtype_ == Subtype::kRed; 85 return subtype_ == Subtype::kRed;
81 } 86 }
82 87
83 // Returns true if the decoder's format is named |name|. 88 // Returns true if the decoder's format is named |name|.
84 bool IsType(const char* name) const; 89 bool IsType(const char* name) const;
85 // Returns true if the decoder's format is named |name|. 90 // Returns true if the decoder's format is named |name|.
86 bool IsType(const std::string& name) const; 91 bool IsType(const std::string& name) const;
87 92
88 // TODO(ossu): |name| is kept here while we retain the old external decoder 93 const std::string& get_name() const { return name_; }
89 // interface. Remove this once using an AudioDecoderFactory has
90 // supplanted the old functionality.
91 std::string name;
92 94
93 private: 95 private:
96 // TODO(ossu): |name_| is kept here while we retain the old external
97 // decoder interface. Remove this once using an
98 // AudioDecoderFactory has supplanted the old functionality.
99 const std::string name_;
100
94 const SdpAudioFormat audio_format_; 101 const SdpAudioFormat audio_format_;
95 AudioDecoderFactory* const factory_; 102 AudioDecoderFactory* const factory_;
96 mutable std::unique_ptr<AudioDecoder> decoder_; 103 mutable std::unique_ptr<AudioDecoder> decoder_;
97 104
98 // Set iff this is an external decoder. 105 // Set iff this is an external decoder.
99 AudioDecoder* const external_decoder_; 106 AudioDecoder* const external_decoder_;
100 107
101 // Set iff this is a comfort noise decoder. 108 // Set iff this is a comfort noise decoder.
102 struct CngDecoder { 109 struct CngDecoder {
103 static rtc::Optional<CngDecoder> Create(const SdpAudioFormat& format); 110 static rtc::Optional<CngDecoder> Create(const SdpAudioFormat& format);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 int active_decoder_type_; 227 int active_decoder_type_;
221 int active_cng_decoder_type_; 228 int active_cng_decoder_type_;
222 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_; 229 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_;
223 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; 230 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
224 231
225 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); 232 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase);
226 }; 233 };
227 234
228 } // namespace webrtc 235 } // namespace webrtc
229 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ 236 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698