#include "third_party/blink/renderer/modules/mediarecorder/audio_track_recorder.h"
#include <memory>
#include "base/check_op.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_parameters.h"
#include "third_party/blink/renderer/modules/mediarecorder/audio_track_encoder.h"
#include "third_party/blink/renderer/modules/mediarecorder/audio_track_mojo_encoder.h"
#include "third_party/blink/renderer/modules/mediarecorder/audio_track_opus_encoder.h"
#include "third_party/blink/renderer/modules/mediarecorder/audio_track_pcm_encoder.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_track.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_component.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_source.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_base.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_copier_std.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/string_view.h"
#include "third_party/blink/renderer/platform/wtf/wtf.h"
#if BUILDFLAG(IS_WIN) || ((BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID)) && \
BUILDFLAG(USE_PROPRIETARY_CODECS))
#define HAS_AAC_ENCODER …
#endif
namespace WTF {
template <>
struct CrossThreadCopier<media::AudioParameters> { … };
}
namespace blink {
const int kMaxChunkedBufferDurationMs = …;
AudioTrackRecorder::CodecId AudioTrackRecorder::GetPreferredCodecId(
MediaTrackContainerType type) { … }
AudioTrackRecorder::AudioTrackRecorder(
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner,
CodecId codec,
MediaStreamComponent* track,
WeakCell<CallbackInterface>* callback_interface,
uint32_t bits_per_second,
BitrateMode bitrate_mode,
scoped_refptr<base::SequencedTaskRunner> encoder_task_runner)
: … { … }
AudioTrackRecorder::~AudioTrackRecorder() { … }
std::unique_ptr<AudioTrackEncoder> AudioTrackRecorder::CreateAudioEncoder(
CodecId codec,
scoped_refptr<base::SequencedTaskRunner> encoder_task_runner,
OnEncodedAudioCB on_encoded_audio_cb,
OnEncodedAudioErrorCB on_encoded_audio_error_cb,
uint32_t bits_per_second,
BitrateMode bitrate_mode) { … }
void AudioTrackRecorder::OnSetFormat(const media::AudioParameters& params) { … }
void AudioTrackRecorder::OnData(const media::AudioBus& audio_bus,
base::TimeTicks capture_time) { … }
void AudioTrackRecorder::Pause() { … }
void AudioTrackRecorder::Resume() { … }
void AudioTrackRecorder::ConnectToTrack() { … }
void AudioTrackRecorder::DisconnectFromTrack() { … }
}