#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/filters/vpx_video_decoder.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <string>
#include <vector>
#include "base/containers/span.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/byte_conversions.h"
#include "base/task/bind_post_task.h"
#include "base/trace_event/trace_event.h"
#include "media/base/decoder_buffer.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/base/video_aspect_ratio.h"
#include "media/filters/ffmpeg_video_decoder.h"
#include "third_party/libvpx/source/libvpx/vpx/vp8dx.h"
#include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h"
#include "third_party/libvpx/source/libvpx/vpx/vpx_frame_buffer.h"
#include "third_party/libyuv/include/libyuv/convert.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"
namespace media {
static int GetVpxVideoDecoderThreadCount(const VideoDecoderConfig& config) { … }
static std::unique_ptr<vpx_codec_ctx> InitializeVpxContext(
const VideoDecoderConfig& config) { … }
static int32_t GetVP9FrameBuffer(void* user_priv,
size_t min_size,
vpx_codec_frame_buffer* fb) { … }
static int32_t ReleaseVP9FrameBuffer(void* user_priv,
vpx_codec_frame_buffer* fb) { … }
SupportedVideoDecoderConfigs VpxVideoDecoder::SupportedConfigs() { … }
VpxVideoDecoder::VpxVideoDecoder(OffloadState offload_state)
: … { … }
VpxVideoDecoder::~VpxVideoDecoder() { … }
VideoDecoderType VpxVideoDecoder::GetDecoderType() const { … }
void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool ,
CdmContext* ,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& ) { … }
void VpxVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) { … }
void VpxVideoDecoder::Reset(base::OnceClosure reset_cb) { … }
bool VpxVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config) { … }
void VpxVideoDecoder::CloseDecoder() { … }
void VpxVideoDecoder::Detach() { … }
bool VpxVideoDecoder::VpxDecode(const DecoderBuffer* buffer,
scoped_refptr<VideoFrame>* video_frame) { … }
VpxVideoDecoder::AlphaDecodeStatus VpxVideoDecoder::DecodeAlphaPlane(
const struct vpx_image* vpx_image,
const struct vpx_image** vpx_image_alpha,
const DecoderBuffer* buffer) { … }
bool VpxVideoDecoder::CopyVpxImageToVideoFrame(
const struct vpx_image* vpx_image,
const struct vpx_image* vpx_image_alpha,
scoped_refptr<VideoFrame>* video_frame) { … }
}