#include "media/gpu/test/video_encoder/bitstream_validator.h"
#include <numeric>
#include <optional>
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/ranges/algorithm.h"
#include "base/synchronization/waitable_event.h"
#include "media/base/decoder_buffer.h"
#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/base/media_util.h"
#include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h"
#include "media/filters/dav1d_video_decoder.h"
#include "media/filters/ffmpeg_video_decoder.h"
#include "media/filters/vpx_video_decoder.h"
#include "media/gpu/macros.h"
#include "media/gpu/test/video_encoder/decoder_buffer_validator.h"
#include "media/gpu/test/video_frame_helpers.h"
namespace media {
namespace test {
namespace {
constexpr int64_t kEOSTimeStamp = …;
std::unique_ptr<VideoDecoder> CreateDecoder(
VideoCodec codec,
std::unique_ptr<MediaLog>* media_log) { … }
}
std::unique_ptr<BitstreamValidator> BitstreamValidator::Create(
const VideoDecoderConfig& decoder_config,
size_t last_frame_index,
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors,
std::optional<size_t> spatial_layer_index_to_decode,
std::optional<size_t> temporal_layer_index_to_decode,
const std::vector<gfx::Size>& spatial_layer_resolutions) { … }
bool BitstreamValidator::Initialize(const VideoDecoderConfig& decoder_config) { … }
void BitstreamValidator::InitializeVideoDecoder(
const VideoDecoderConfig& decoder_config,
VideoDecoder::InitCB init_cb) { … }
BitstreamValidator::BitstreamValidator(
std::unique_ptr<VideoDecoder> decoder,
std::unique_ptr<MediaLog> media_log,
size_t last_frame_index,
const gfx::Rect& decoding_rect,
std::optional<size_t> spatial_layer_index_to_decode,
std::optional<size_t> temporal_layer_index_to_decode,
const std::vector<gfx::Size>& spatial_layer_resolutions,
std::vector<std::unique_ptr<VideoFrameProcessor>> video_frame_processors)
: … { … }
BitstreamValidator::~BitstreamValidator() { … }
void BitstreamValidator::ConstructSpatialIndices(
const std::vector<gfx::Size>& spatial_layer_resolutions) { … }
void BitstreamValidator::ProcessBitstream(scoped_refptr<BitstreamRef> bitstream,
size_t frame_index) { … }
void BitstreamValidator::ProcessBitstreamTask(
scoped_refptr<BitstreamRef> bitstream,
size_t frame_index) { … }
void BitstreamValidator::DecodeDone(int64_t timestamp, DecoderStatus status) { … }
void BitstreamValidator::OutputFrameProcessed() { … }
void BitstreamValidator::VerifyOutputFrame(scoped_refptr<VideoFrame> frame) { … }
bool BitstreamValidator::WaitUntilDone() { … }
}
}