Set decoder output frequency in AudioDecoder::Decode call
This CL changes the way the decoder sample rate is set and updated. In practice, it only concerns the iSAC (float) codec. One single iSAC decoder instance is used for both wideband and super-wideband decoding, and the instance must be told to switch output frequency if the payload type changes. This used to be done through a call to UpdateDecoderSampleRate, but is now instead done in the Decode call as an extra parameter. R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/34349004 Cr-Commit-Position: refs/heads/master@{#8476} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8476 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -37,8 +37,11 @@ namespace webrtc {
|
||||
class AudioDecoderPcmU : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcmU() {}
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual int Init() { return 0; }
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len) const;
|
||||
|
||||
@ -49,8 +52,11 @@ class AudioDecoderPcmU : public AudioDecoder {
|
||||
class AudioDecoderPcmA : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcmA() {}
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual int Init() { return 0; }
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len) const;
|
||||
|
||||
@ -86,8 +92,11 @@ class AudioDecoderPcmAMultiCh : public AudioDecoderPcmA {
|
||||
class AudioDecoderPcm16B : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcm16B();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual int Init() { return 0; }
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len) const;
|
||||
|
||||
@ -112,8 +121,11 @@ class AudioDecoderIlbc : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderIlbc();
|
||||
virtual ~AudioDecoderIlbc();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual bool HasDecodePlc() const { return true; }
|
||||
virtual int DecodePlc(int num_frames, int16_t* decoded);
|
||||
virtual int Init();
|
||||
@ -129,8 +141,11 @@ class AudioDecoderG722 : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderG722();
|
||||
virtual ~AudioDecoderG722();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual bool HasDecodePlc() const { return false; }
|
||||
virtual int Init();
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len) const;
|
||||
@ -144,8 +159,11 @@ class AudioDecoderG722Stereo : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderG722Stereo();
|
||||
virtual ~AudioDecoderG722Stereo();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual int Init();
|
||||
|
||||
private:
|
||||
@ -169,10 +187,16 @@ class AudioDecoderOpus : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderOpus(int num_channels);
|
||||
virtual ~AudioDecoderOpus();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int DecodeRedundant(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual int DecodeRedundant(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
virtual int Init();
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len) const;
|
||||
virtual int PacketDurationRedundant(const uint8_t* encoded,
|
||||
@ -195,8 +219,13 @@ class AudioDecoderCng : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderCng();
|
||||
virtual ~AudioDecoderCng();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type) { return -1; }
|
||||
virtual int Decode(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int /*sample_rate_hz*/,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
return -1;
|
||||
}
|
||||
virtual int Init();
|
||||
virtual int IncomingPacket(const uint8_t* payload,
|
||||
size_t payload_len,
|
||||
|
||||
Reference in New Issue
Block a user