#include "audio/audio_transport_impl.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "audio/remix_resample.h"
#include "audio/utility/audio_frame_operations.h"
#include "call/audio_sender.h"
#include "modules/async_audio_processing/async_audio_processing.h"
#include "modules/audio_processing/include/audio_frame_proxies.h"
#include "rtc_base/checks.h"
#include "rtc_base/trace_event.h"
namespace webrtc {
namespace {
void InitializeCaptureFrame(int input_sample_rate,
int send_sample_rate_hz,
size_t input_num_channels,
size_t send_num_channels,
AudioFrame* audio_frame) { … }
void ProcessCaptureFrame(uint32_t delay_ms,
bool key_pressed,
bool swap_stereo_channels,
AudioProcessing* audio_processing,
AudioFrame* audio_frame) { … }
int Resample(const AudioFrame& frame,
const int destination_sample_rate,
PushResampler<int16_t>* resampler,
InterleavedView<int16_t> destination) { … }
}
AudioTransportImpl::AudioTransportImpl(
AudioMixer* mixer,
AudioProcessing* audio_processing,
AsyncAudioProcessing::Factory* async_audio_processing_factory)
: … { … }
AudioTransportImpl::~AudioTransportImpl() { … }
int32_t AudioTransportImpl::RecordedDataIsAvailable(
const void* audio_data,
size_t number_of_frames,
size_t bytes_per_sample,
size_t number_of_channels,
uint32_t sample_rate,
uint32_t audio_delay_milliseconds,
int32_t clock_drift,
uint32_t volume,
bool key_pressed,
uint32_t& new_mic_volume) { … }
int32_t AudioTransportImpl::RecordedDataIsAvailable(
const void* audio_data,
size_t number_of_frames,
size_t bytes_per_sample,
size_t number_of_channels,
uint32_t sample_rate,
uint32_t audio_delay_milliseconds,
int32_t ,
uint32_t ,
bool key_pressed,
uint32_t& ,
absl::optional<int64_t>
estimated_capture_time_ns) { … }
void AudioTransportImpl::SendProcessedData(
std::unique_ptr<AudioFrame> audio_frame) { … }
int32_t AudioTransportImpl::NeedMorePlayData(const size_t nSamples,
const size_t nBytesPerSample,
const size_t nChannels,
const uint32_t samplesPerSec,
void* audioSamples,
size_t& nSamplesOut,
int64_t* elapsed_time_ms,
int64_t* ntp_time_ms) { … }
void AudioTransportImpl::PullRenderData(int bits_per_sample,
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
void* audio_data,
int64_t* elapsed_time_ms,
int64_t* ntp_time_ms) { … }
void AudioTransportImpl::UpdateAudioSenders(std::vector<AudioSender*> senders,
int send_sample_rate_hz,
size_t send_num_channels) { … }
void AudioTransportImpl::SetStereoChannelSwapping(bool enable) { … }
}