Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/decoder_database.h |
| diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.h b/webrtc/modules/audio_coding/neteq/decoder_database.h |
| index 6d277c95c9f013525a5fcede31ae0f236ee12021..82912a101d91da4884d285d8bb506be633837d2b 100644 |
| --- a/webrtc/modules/audio_coding/neteq/decoder_database.h |
| +++ b/webrtc/modules/audio_coding/neteq/decoder_database.h |
| @@ -41,13 +41,13 @@ class DecoderDatabase { |
| // Class that stores decoder info in the database. |
| class DecoderInfo { |
| public: |
| - DecoderInfo( |
| + explicit DecoderInfo( |
| + const SdpAudioFormat& audio_format, |
| + AudioDecoderFactory* factory = nullptr); |
| + explicit DecoderInfo( |
| NetEqDecoder ct, |
| - const std::string& nm, |
| AudioDecoderFactory* factory = nullptr); |
| - DecoderInfo(NetEqDecoder ct, |
| - const std::string& nm, |
| - AudioDecoder* ext_dec); |
| + DecoderInfo(const SdpAudioFormat& audio_format, AudioDecoder* ext_dec); |
| DecoderInfo(DecoderInfo&&); |
| ~DecoderInfo(); |
| @@ -64,25 +64,29 @@ class DecoderDatabase { |
| return decoder ? decoder->SampleRateHz() : cng_decoder_->sample_rate_hz; |
| } |
| - const SdpAudioFormat& GetFormat() const { |
| - RTC_DCHECK(audio_format_); |
| - return *audio_format_; |
| - } |
| + const SdpAudioFormat& GetFormat() const { return audio_format_; } |
| - // Returns true if |codec_type| is comfort noise. |
| + // Returns true if the decoder's format is comfort noise. |
| bool IsComfortNoise() const; |
| - // Returns true if |codec_type| is DTMF. |
| + // Returns true if the decoder's format is DTMF. |
| bool IsDtmf() const; |
| - // Returns true if |codec_type| is RED. |
| + // Returns true if the decoder's format is RED. |
| bool IsRed() const; |
| - const NetEqDecoder codec_type; |
| - const std::string name; |
| + // Returns if the decoder's format is named |name|. |
| + bool IsType(const char *name) const; |
| + // Returns if the decoder's format is named |name|. |
| + bool IsType(const std::string& name) const; |
| + |
| + // TODO(ossu): |name| is kept here while we retain the old external decoder |
| + // interface. Remove this once using an AudioDecoderFactory has |
| + // supplanted the old functionality. |
| + std::string name; |
|
kwiberg-webrtc
2016/09/20 16:05:43
Why can't we just use the name field in audio_form
ossu
2016/09/21 09:10:56
I tried that, but there were some ambiguities for
kwiberg-webrtc
2016/09/21 09:21:19
Acknowledged.
|
| private: |
| - const rtc::Optional<SdpAudioFormat> audio_format_; |
| + const SdpAudioFormat audio_format_; |
| AudioDecoderFactory* factory_; |
|
kwiberg-webrtc
2016/09/20 16:05:43
Consider making this const; I think you forget to
ossu
2016/09/21 09:10:55
Acknowledged.
|
| mutable std::unique_ptr<AudioDecoder> decoder_; |
| @@ -91,7 +95,7 @@ class DecoderDatabase { |
| // Set iff this is a comfort noise decoder. |
| struct CngDecoder { |
| - static rtc::Optional<CngDecoder> Create(NetEqDecoder ct); |
| + static rtc::Optional<CngDecoder> Create(const SdpAudioFormat& format); |
| int sample_rate_hz; |
| }; |
| const rtc::Optional<CngDecoder> cng_decoder_; |
| @@ -140,12 +144,6 @@ class DecoderDatabase { |
| // no decoder is registered with that |rtp_payload_type|, NULL is returned. |
| virtual const DecoderInfo* GetDecoderInfo(uint8_t rtp_payload_type) const; |
| - // Returns one RTP payload type associated with |codec_type|, or |
| - // kDecoderNotFound if no entry exists for that value. Note that one |
| - // |codec_type| may be registered with several RTP payload types, and the |
| - // method may return any of them. |
| - virtual uint8_t GetRtpPayloadType(NetEqDecoder codec_type) const; |
| - |
| // Sets the active decoder to be |rtp_payload_type|. If this call results in a |
| // change of active decoder, |new_decoder| is set to true. The previous active |
| // decoder's AudioDecoder object is deleted. |
| @@ -172,8 +170,11 @@ class DecoderDatabase { |
| // object does not exist for that decoder, the object is created. |
| AudioDecoder* GetDecoder(uint8_t rtp_payload_type) const; |
| - // Returns true if |rtp_payload_type| is registered as a |codec_type|. |
| - bool IsType(uint8_t rtp_payload_type, NetEqDecoder codec_type) const; |
| + // Returns if |rtp_payload_type| is registered with a format named |name|. |
| + bool IsType(uint8_t rtp_payload_type, const char *name) const; |
| + |
| + // Returns if |rtp_payload_type| is registered with a format named |name|. |
| + bool IsType(uint8_t rtp_payload_type, const std::string& name) const; |
| // Returns true if |rtp_payload_type| is registered as comfort noise. |
| bool IsComfortNoise(uint8_t rtp_payload_type) const; |