#include "remoting/protocol/audio_pump.h"
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_sample_types.h"
#include "media/base/channel_layout.h"
#include "media/base/channel_mixer.h"
#include "remoting/codec/audio_encoder.h"
#include "remoting/proto/audio.pb.h"
#include "remoting/protocol/audio_source.h"
#include "remoting/protocol/audio_stub.h"
namespace {
int CalculateFrameCount(const remoting::AudioPacket& packet) { … }
std::unique_ptr<media::AudioBus> AudioPacketToAudioBus(
const remoting::AudioPacket& packet) { … }
std::unique_ptr<remoting::AudioPacket> AudioBusToAudioPacket(
const media::AudioBus& packet) { … }
media::ChannelLayout RetrieveLayout(const remoting::AudioPacket& packet) { … }
}
namespace remoting::protocol {
const int kMaxBufferedIntervalMs = …;
class AudioPump::Core { … };
AudioPump::Core::Core(base::WeakPtr<AudioPump> pump,
std::unique_ptr<AudioSource> audio_source,
std::unique_ptr<AudioEncoder> audio_encoder)
: … { … }
AudioPump::Core::~Core() { … }
void AudioPump::Core::Start() { … }
void AudioPump::Core::Pause(bool pause) { … }
void AudioPump::Core::OnPacketSent(int size) { … }
void AudioPump::Core::EncodeAudioPacket(std::unique_ptr<AudioPacket> packet) { … }
std::unique_ptr<AudioPacket> AudioPump::Core::Downmix(
std::unique_ptr<AudioPacket> packet) { … }
AudioPump::AudioPump(
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
std::unique_ptr<AudioSource> audio_source,
std::unique_ptr<AudioEncoder> audio_encoder,
AudioStub* audio_stub)
: … { … }
AudioPump::~AudioPump() { … }
void AudioPump::Pause(bool pause) { … }
void AudioPump::SendAudioPacket(std::unique_ptr<AudioPacket> packet, int size) { … }
void AudioPump::OnPacketSent(int size) { … }
}