#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/filters/ffmpeg_video_decoder.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <numeric>
#include "base/bits.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "media/base/decoder_buffer.h"
#include "media/base/limits.h"
#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/base/supported_types.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_aspect_ratio.h"
#include "media/base/video_frame.h"
#include "media/base/video_util.h"
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/ffmpeg/ffmpeg_decoding_loop.h"
#include "media/filters/ffmpeg_glue.h"
namespace media {
namespace {
struct OpaqueData { … };
}
static int GetFFmpegVideoDecoderThreadCount(const VideoDecoderConfig& config) { … }
static int GetVideoBufferImpl(struct AVCodecContext* s,
AVFrame* frame,
int flags) { … }
static void ReleaseVideoBufferImpl(void* opaque, uint8_t* data) { … }
bool FFmpegVideoDecoder::IsCodecSupported(VideoCodec codec) { … }
FFmpegVideoDecoder::FFmpegVideoDecoder(MediaLog* media_log)
: … { … }
int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
AVFrame* frame,
int flags) { … }
VideoDecoderType FFmpegVideoDecoder::GetDecoderType() const { … }
void FFmpegVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool low_delay,
CdmContext* ,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& ) { … }
void FFmpegVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) { … }
void FFmpegVideoDecoder::Reset(base::OnceClosure closure) { … }
FFmpegVideoDecoder::~FFmpegVideoDecoder() { … }
bool FFmpegVideoDecoder::FFmpegDecode(const DecoderBuffer& buffer) { … }
bool FFmpegVideoDecoder::OnNewFrame(AVFrame* frame) { … }
void FFmpegVideoDecoder::ReleaseFFmpegResources() { … }
bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config,
bool low_delay) { … }
}