#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/filters/ffmpeg_audio_decoder.h"
#include <stdint.h>
#include <functional>
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/audio_discard_helper.h"
#include "media/base/decoder_buffer.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/base/timestamp_constants.h"
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/ffmpeg/ffmpeg_decoding_loop.h"
#include "media/filters/ffmpeg_glue.h"
namespace media {
static inline int DetermineChannels(AVFrame* frame) { … }
static int GetAudioBufferImpl(struct AVCodecContext* s,
AVFrame* frame,
int flags) { … }
static void ReleaseAudioBufferImpl(void* opaque, uint8_t* data) { … }
FFmpegAudioDecoder::FFmpegAudioDecoder(
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
MediaLog* media_log)
: … { … }
FFmpegAudioDecoder::~FFmpegAudioDecoder() { … }
AudioDecoderType FFmpegAudioDecoder::GetDecoderType() const { … }
void FFmpegAudioDecoder::Initialize(const AudioDecoderConfig& config,
CdmContext* ,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& ) { … }
void FFmpegAudioDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) { … }
void FFmpegAudioDecoder::Reset(base::OnceClosure closure) { … }
void FFmpegAudioDecoder::DecodeBuffer(const DecoderBuffer& buffer,
DecodeCB decode_cb) { … }
bool FFmpegAudioDecoder::FFmpegDecode(const DecoderBuffer& buffer) { … }
bool FFmpegAudioDecoder::OnNewFrame(const DecoderBuffer& buffer,
bool* decoded_frame_this_loop,
AVFrame* frame) { … }
void FFmpegAudioDecoder::ReleaseFFmpegResources() { … }
bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) { … }
void FFmpegAudioDecoder::ResetTimestampState(const AudioDecoderConfig& config) { … }
int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
AVFrame* frame,
int flags) { … }
}