2015-09-15 17:28:18 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
|
|
|
|
|
#define MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
|
2015-09-15 17:28:18 +02:00
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <stdint.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2018-10-23 12:03:01 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/audio_codecs/audio_decoder.h"
|
2024-08-16 14:27:43 +02:00
|
|
|
#include "api/field_trials_view.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_coding/codecs/opus/opus_interface.h"
|
2018-10-23 12:03:01 +02:00
|
|
|
#include "rtc_base/buffer.h"
|
2015-09-15 17:28:18 +02:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2017-06-30 05:24:56 -07:00
|
|
|
class AudioDecoderOpusImpl final : public AudioDecoder {
|
2015-09-15 17:28:18 +02:00
|
|
|
public:
|
2024-08-16 14:27:43 +02:00
|
|
|
explicit AudioDecoderOpusImpl(const FieldTrialsView& field_trails,
|
|
|
|
|
size_t num_channels,
|
|
|
|
|
int sample_rate_hz);
|
|
|
|
|
|
2017-06-30 05:24:56 -07:00
|
|
|
~AudioDecoderOpusImpl() override;
|
2015-09-15 17:28:18 +02:00
|
|
|
|
2022-01-21 09:49:39 +09:00
|
|
|
AudioDecoderOpusImpl(const AudioDecoderOpusImpl&) = delete;
|
|
|
|
|
AudioDecoderOpusImpl& operator=(const AudioDecoderOpusImpl&) = delete;
|
|
|
|
|
|
2016-09-22 02:06:28 -07:00
|
|
|
std::vector<ParseResult> ParsePayload(rtc::Buffer&& payload,
|
|
|
|
|
uint32_t timestamp) override;
|
2015-09-15 17:28:18 +02:00
|
|
|
void Reset() override;
|
|
|
|
|
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
|
|
|
|
|
int PacketDurationRedundant(const uint8_t* encoded,
|
|
|
|
|
size_t encoded_len) const override;
|
|
|
|
|
bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const override;
|
2016-05-31 02:46:20 -07:00
|
|
|
int SampleRateHz() const override;
|
2015-09-15 17:28:18 +02:00
|
|
|
size_t Channels() const override;
|
2024-01-24 09:48:01 +01:00
|
|
|
void GeneratePlc(size_t requested_samples_per_channel,
|
|
|
|
|
rtc::BufferT<int16_t>* concealment_audio) override;
|
2015-09-15 17:28:18 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
int DecodeInternal(const uint8_t* encoded,
|
|
|
|
|
size_t encoded_len,
|
|
|
|
|
int sample_rate_hz,
|
|
|
|
|
int16_t* decoded,
|
|
|
|
|
SpeechType* speech_type) override;
|
|
|
|
|
int DecodeRedundantInternal(const uint8_t* encoded,
|
|
|
|
|
size_t encoded_len,
|
|
|
|
|
int sample_rate_hz,
|
|
|
|
|
int16_t* decoded,
|
|
|
|
|
SpeechType* speech_type) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
OpusDecInst* dec_state_;
|
|
|
|
|
const size_t channels_;
|
2019-05-29 13:46:09 +02:00
|
|
|
const int sample_rate_hz_;
|
2024-01-24 09:48:01 +01:00
|
|
|
const bool generate_plc_;
|
2015-09-15 17:28:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_CODING_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
|