chromium/third_party/webrtc/modules/audio_coding/neteq/neteq_impl.cc

/*
 *  Copyright (c) 2012 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.
 */

#include "modules/audio_coding/neteq/neteq_impl.h"

#include <algorithm>
#include <cstdint>
#include <cstring>
#include <list>
#include <map>
#include <memory>
#include <utility>
#include <vector>

#include "api/audio_codecs/audio_decoder.h"
#include "api/neteq/neteq_controller.h"
#include "api/neteq/tick_timer.h"
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "modules/audio_coding/codecs/cng/webrtc_cng.h"
#include "modules/audio_coding/neteq/accelerate.h"
#include "modules/audio_coding/neteq/background_noise.h"
#include "modules/audio_coding/neteq/comfort_noise.h"
#include "modules/audio_coding/neteq/decision_logic.h"
#include "modules/audio_coding/neteq/decoder_database.h"
#include "modules/audio_coding/neteq/dtmf_buffer.h"
#include "modules/audio_coding/neteq/dtmf_tone_generator.h"
#include "modules/audio_coding/neteq/expand.h"
#include "modules/audio_coding/neteq/merge.h"
#include "modules/audio_coding/neteq/nack_tracker.h"
#include "modules/audio_coding/neteq/normal.h"
#include "modules/audio_coding/neteq/packet.h"
#include "modules/audio_coding/neteq/packet_buffer.h"
#include "modules/audio_coding/neteq/preemptive_expand.h"
#include "modules/audio_coding/neteq/red_payload_splitter.h"
#include "modules/audio_coding/neteq/statistics_calculator.h"
#include "modules/audio_coding/neteq/sync_buffer.h"
#include "modules/audio_coding/neteq/time_stretch.h"
#include "modules/audio_coding/neteq/timestamp_scaler.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/sanitizer.h"
#include "rtc_base/strings/audio_format_to_string.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/clock.h"

namespace webrtc {
namespace {

AudioFrame::SpeechType ToSpeechType(NetEqImpl::OutputType type) {}

// Returns true if both payload types are known to the decoder database, and
// have the same sample rate.
bool EqualSampleRates(uint8_t pt1,
                      uint8_t pt2,
                      const DecoderDatabase& decoder_database) {}

}  // namespace

NetEqImpl::Dependencies::Dependencies(
    const Environment& env,
    const NetEq::Config& config,
    scoped_refptr<AudioDecoderFactory> decoder_factory,
    const NetEqControllerFactory& controller_factory)
    :{}

NetEqImpl::Dependencies::~Dependencies() = default;

NetEqImpl::NetEqImpl(const NetEq::Config& config,
                     Dependencies&& deps,
                     bool create_components)
    :{}

NetEqImpl::~NetEqImpl() = default;

int NetEqImpl::InsertPacket(const RTPHeader& rtp_header,
                            rtc::ArrayView<const uint8_t> payload,
                            Timestamp receive_time) {}

void NetEqImpl::InsertEmptyPacket(const RTPHeader& rtp_header) {}

int NetEqImpl::GetAudio(AudioFrame* audio_frame,
                        bool* muted,
                        int* current_sample_rate_hz,
                        absl::optional<Operation> action_override) {}

void NetEqImpl::SetCodecs(const std::map<int, SdpAudioFormat>& codecs) {}

bool NetEqImpl::RegisterPayloadType(int rtp_payload_type,
                                    const SdpAudioFormat& audio_format) {}

int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) {}

void NetEqImpl::RemoveAllPayloadTypes() {}

bool NetEqImpl::SetMinimumDelay(int delay_ms) {}

bool NetEqImpl::SetMaximumDelay(int delay_ms) {}

bool NetEqImpl::SetBaseMinimumDelayMs(int delay_ms) {}

int NetEqImpl::GetBaseMinimumDelayMs() const {}

int NetEqImpl::TargetDelayMs() const {}

int NetEqImpl::FilteredCurrentDelayMs() const {}

int NetEqImpl::NetworkStatistics(NetEqNetworkStatistics* stats) {}

NetEqNetworkStatistics NetEqImpl::CurrentNetworkStatistics() const {}

NetEqNetworkStatistics NetEqImpl::CurrentNetworkStatisticsInternal() const {}

NetEqLifetimeStatistics NetEqImpl::GetLifetimeStatistics() const {}

NetEqOperationsAndState NetEqImpl::GetOperationsAndState() const {}

absl::optional<uint32_t> NetEqImpl::GetPlayoutTimestamp() const {}

int NetEqImpl::last_output_sample_rate_hz() const {}

absl::optional<NetEq::DecoderFormat> NetEqImpl::GetCurrentDecoderFormat()
    const {}

void NetEqImpl::FlushBuffers() {}

void NetEqImpl::EnableNack(size_t max_nack_list_size) {}

void NetEqImpl::DisableNack() {}

std::vector<uint16_t> NetEqImpl::GetNackList(int64_t round_trip_time_ms) const {}

int NetEqImpl::SyncBufferSizeMs() const {}

const SyncBuffer* NetEqImpl::sync_buffer_for_test() const {}

NetEq::Operation NetEqImpl::last_operation_for_test() const {}

// Methods below this line are private.

int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header,
                                    rtc::ArrayView<const uint8_t> payload,
                                    Timestamp receive_time) {}

bool NetEqImpl::MaybeChangePayloadType(uint8_t payload_type) {}

int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame,
                                absl::optional<Operation> action_override) {}

int NetEqImpl::GetDecision(Operation* operation,
                           PacketList* packet_list,
                           DtmfEvent* dtmf_event,
                           bool* play_dtmf,
                           absl::optional<Operation> action_override) {}

int NetEqImpl::Decode(PacketList* packet_list,
                      Operation* operation,
                      int* decoded_length,
                      AudioDecoder::SpeechType* speech_type) {}

int NetEqImpl::DecodeCng(AudioDecoder* decoder,
                         int* decoded_length,
                         AudioDecoder::SpeechType* speech_type) {}

int NetEqImpl::DecodeLoop(PacketList* packet_list,
                          const Operation& operation,
                          AudioDecoder* decoder,
                          int* decoded_length,
                          AudioDecoder::SpeechType* speech_type) {}

void NetEqImpl::DoNormal(const int16_t* decoded_buffer,
                         size_t decoded_length,
                         AudioDecoder::SpeechType speech_type,
                         bool play_dtmf) {}

void NetEqImpl::DoMerge(int16_t* decoded_buffer,
                        size_t decoded_length,
                        AudioDecoder::SpeechType speech_type,
                        bool play_dtmf) {}

bool NetEqImpl::DoCodecPlc() {}

int NetEqImpl::DoExpand(bool play_dtmf) {}

int NetEqImpl::DoAccelerate(int16_t* decoded_buffer,
                            size_t decoded_length,
                            AudioDecoder::SpeechType speech_type,
                            bool play_dtmf,
                            bool fast_accelerate) {}

int NetEqImpl::DoPreemptiveExpand(int16_t* decoded_buffer,
                                  size_t decoded_length,
                                  AudioDecoder::SpeechType speech_type,
                                  bool play_dtmf) {}

int NetEqImpl::DoRfc3389Cng(PacketList* packet_list, bool play_dtmf) {}

void NetEqImpl::DoCodecInternalCng(const int16_t* decoded_buffer,
                                   size_t decoded_length) {}

int NetEqImpl::DoDtmf(const DtmfEvent& dtmf_event, bool* play_dtmf) {}

int NetEqImpl::DtmfOverdub(const DtmfEvent& dtmf_event,
                           size_t num_channels,
                           int16_t* output) const {}

int NetEqImpl::ExtractPackets(size_t required_samples,
                              PacketList* packet_list) {}

void NetEqImpl::UpdatePlcComponents(int fs_hz, size_t channels) {}

void NetEqImpl::SetSampleRateAndChannels(int fs_hz, size_t channels) {}

NetEqImpl::OutputType NetEqImpl::LastOutputType() {}

NetEqController::PacketArrivedInfo NetEqImpl::ToPacketArrivedInfo(
    const Packet& packet) const {}

}  // namespace webrtc