Revert of Opus implementation of the AudioDecoderFactoryTemplate API (patchset #1 id:1 of https://codereview.webrtc.org/2942733003/ )
Reason for revert:
breaking downstream projects
Original issue's description:
> Opus implementation of the AudioDecoderFactoryTemplate API
>
> BUG=webrtc:7837
>
> Review-Url: https://codereview.webrtc.org/2942733003
> Cr-Commit-Position: refs/heads/master@{#18646}
> Committed: d053fe4ab3
TBR=ossu@webrtc.org,solenberg@webrtc.org,kwiberg@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7837
Review-Url: https://codereview.webrtc.org/2944763002
Cr-Commit-Position: refs/heads/master@{#18648}
This commit is contained in:
@ -162,7 +162,7 @@ NamedDecoderConstructor decoder_constructors[] = {
|
||||
if (format.clockrate_hz == 48000 && format.num_channels == 2 &&
|
||||
num_channels) {
|
||||
if (out) {
|
||||
out->reset(new AudioDecoderOpusImpl(*num_channels));
|
||||
out->reset(new AudioDecoderOpus(*num_channels));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@ -19,7 +19,7 @@ namespace webrtc {
|
||||
namespace {
|
||||
class OpusFrame : public AudioDecoder::EncodedAudioFrame {
|
||||
public:
|
||||
OpusFrame(AudioDecoderOpusImpl* decoder,
|
||||
OpusFrame(AudioDecoderOpus* decoder,
|
||||
rtc::Buffer&& payload,
|
||||
bool is_primary_payload)
|
||||
: decoder_(decoder),
|
||||
@ -57,25 +57,25 @@ class OpusFrame : public AudioDecoder::EncodedAudioFrame {
|
||||
}
|
||||
|
||||
private:
|
||||
AudioDecoderOpusImpl* const decoder_;
|
||||
AudioDecoderOpus* const decoder_;
|
||||
const rtc::Buffer payload_;
|
||||
const bool is_primary_payload_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
AudioDecoderOpusImpl::AudioDecoderOpusImpl(size_t num_channels)
|
||||
AudioDecoderOpus::AudioDecoderOpus(size_t num_channels)
|
||||
: channels_(num_channels) {
|
||||
RTC_DCHECK(num_channels == 1 || num_channels == 2);
|
||||
WebRtcOpus_DecoderCreate(&dec_state_, channels_);
|
||||
WebRtcOpus_DecoderInit(dec_state_);
|
||||
}
|
||||
|
||||
AudioDecoderOpusImpl::~AudioDecoderOpusImpl() {
|
||||
AudioDecoderOpus::~AudioDecoderOpus() {
|
||||
WebRtcOpus_DecoderFree(dec_state_);
|
||||
}
|
||||
|
||||
std::vector<AudioDecoder::ParseResult> AudioDecoderOpusImpl::ParsePayload(
|
||||
std::vector<AudioDecoder::ParseResult> AudioDecoderOpus::ParsePayload(
|
||||
rtc::Buffer&& payload,
|
||||
uint32_t timestamp) {
|
||||
std::vector<ParseResult> results;
|
||||
@ -95,11 +95,11 @@ std::vector<AudioDecoder::ParseResult> AudioDecoderOpusImpl::ParsePayload(
|
||||
return results;
|
||||
}
|
||||
|
||||
int AudioDecoderOpusImpl::DecodeInternal(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
int AudioDecoderOpus::DecodeInternal(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
RTC_DCHECK_EQ(sample_rate_hz, 48000);
|
||||
int16_t temp_type = 1; // Default is speech.
|
||||
int ret =
|
||||
@ -110,11 +110,11 @@ int AudioDecoderOpusImpl::DecodeInternal(const uint8_t* encoded,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int AudioDecoderOpusImpl::DecodeRedundantInternal(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
int AudioDecoderOpus::DecodeRedundantInternal(const uint8_t* encoded,
|
||||
size_t encoded_len,
|
||||
int sample_rate_hz,
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type) {
|
||||
if (!PacketHasFec(encoded, encoded_len)) {
|
||||
// This packet is a RED packet.
|
||||
return DecodeInternal(encoded, encoded_len, sample_rate_hz, decoded,
|
||||
@ -131,17 +131,17 @@ int AudioDecoderOpusImpl::DecodeRedundantInternal(const uint8_t* encoded,
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AudioDecoderOpusImpl::Reset() {
|
||||
void AudioDecoderOpus::Reset() {
|
||||
WebRtcOpus_DecoderInit(dec_state_);
|
||||
}
|
||||
|
||||
int AudioDecoderOpusImpl::PacketDuration(const uint8_t* encoded,
|
||||
size_t encoded_len) const {
|
||||
int AudioDecoderOpus::PacketDuration(const uint8_t* encoded,
|
||||
size_t encoded_len) const {
|
||||
return WebRtcOpus_DurationEst(dec_state_, encoded, encoded_len);
|
||||
}
|
||||
|
||||
int AudioDecoderOpusImpl::PacketDurationRedundant(const uint8_t* encoded,
|
||||
size_t encoded_len) const {
|
||||
int AudioDecoderOpus::PacketDurationRedundant(const uint8_t* encoded,
|
||||
size_t encoded_len) const {
|
||||
if (!PacketHasFec(encoded, encoded_len)) {
|
||||
// This packet is a RED packet.
|
||||
return PacketDuration(encoded, encoded_len);
|
||||
@ -150,18 +150,18 @@ int AudioDecoderOpusImpl::PacketDurationRedundant(const uint8_t* encoded,
|
||||
return WebRtcOpus_FecDurationEst(encoded, encoded_len);
|
||||
}
|
||||
|
||||
bool AudioDecoderOpusImpl::PacketHasFec(const uint8_t* encoded,
|
||||
size_t encoded_len) const {
|
||||
bool AudioDecoderOpus::PacketHasFec(const uint8_t* encoded,
|
||||
size_t encoded_len) const {
|
||||
int fec;
|
||||
fec = WebRtcOpus_PacketHasFec(encoded, encoded_len);
|
||||
return (fec == 1);
|
||||
}
|
||||
|
||||
int AudioDecoderOpusImpl::SampleRateHz() const {
|
||||
int AudioDecoderOpus::SampleRateHz() const {
|
||||
return 48000;
|
||||
}
|
||||
|
||||
size_t AudioDecoderOpusImpl::Channels() const {
|
||||
size_t AudioDecoderOpus::Channels() const {
|
||||
return channels_;
|
||||
}
|
||||
|
||||
|
||||
@ -17,10 +17,10 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class AudioDecoderOpusImpl final : public AudioDecoder {
|
||||
class AudioDecoderOpus final : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderOpusImpl(size_t num_channels);
|
||||
~AudioDecoderOpusImpl() override;
|
||||
explicit AudioDecoderOpus(size_t num_channels);
|
||||
~AudioDecoderOpus() override;
|
||||
|
||||
std::vector<ParseResult> ParsePayload(rtc::Buffer&& payload,
|
||||
uint32_t timestamp) override;
|
||||
@ -47,7 +47,7 @@ class AudioDecoderOpusImpl final : public AudioDecoder {
|
||||
private:
|
||||
OpusDecInst* dec_state_;
|
||||
const size_t channels_;
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderOpusImpl);
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderOpus);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -433,7 +433,7 @@ class AudioDecoderOpusTest : public AudioDecoderTest {
|
||||
codec_input_rate_hz_ = 48000;
|
||||
frame_size_ = 480;
|
||||
data_length_ = 10 * frame_size_;
|
||||
decoder_ = new AudioDecoderOpusImpl(1);
|
||||
decoder_ = new AudioDecoderOpus(1);
|
||||
AudioEncoderOpusConfig config;
|
||||
config.frame_size_ms = static_cast<int>(frame_size_) / 48;
|
||||
config.application = AudioEncoderOpusConfig::ApplicationMode::kVoip;
|
||||
@ -446,7 +446,7 @@ class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest {
|
||||
AudioDecoderOpusStereoTest() : AudioDecoderOpusTest() {
|
||||
channels_ = 2;
|
||||
delete decoder_;
|
||||
decoder_ = new AudioDecoderOpusImpl(2);
|
||||
decoder_ = new AudioDecoderOpus(2);
|
||||
AudioEncoderOpusConfig config;
|
||||
config.frame_size_ms = static_cast<int>(frame_size_) / 48;
|
||||
config.num_channels = 2;
|
||||
|
||||
Reference in New Issue
Block a user