chromium/third_party/blink/renderer/modules/mediarecorder/audio_track_recorder.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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

// Note that this code follows the Chrome media convention of defining a "frame"
// as "one multi-channel sample" as opposed to another common definition meaning
// "a chunk of samples". Here this second definition of "frame" is called a
// "buffer"; so what might be called "frame duration" is instead "buffer
// duration", and so on.

namespace WTF {

template <>
struct CrossThreadCopier<media::AudioParameters> {};

}  // namespace WTF

namespace blink {

// Max size of buffers passed on to encoders.
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() {}

// Creates an audio encoder from the codec. Returns nullptr if the codec is
// invalid.
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() {}

}  // namespace blink