Commit b8e47968 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu: Vda unittest: Remove GenMD5 test case in favor of ffmpeg

We have GenMD5 only in order to obtain md5 values of decoded frames for a new
stream. ffmpeg has an option to generate md5 of each frame. We should remove
the test case in favor of ffmpeg.

Bug: None
Test: Build vda unittest and vda tests
Test: Confirm the current md5 values match the outputs of "ffmpeg -f framemd5"
Change-Id: I70ae409974e127a0fd54267baad57a1b9c0bb4a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1547485Reviewed-by: default avatarDavid Staessens <dstaessens@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646687}
parent c7738ee3
......@@ -129,10 +129,8 @@ instance, they will be `test-25fps.h264.frames/frame_%{frame-num}_320x180_I420.y
### How to generate md5 values of decoded frames for a new video stream
It is necessary to generate md5 values of decoded frames for new test streams.
For this purpose, run VDATest with `--gtest_filter=VideoDecodeAcceleratorTest.DISABLED_GenMD5 --gtest_also_run_disabled_tests`.
The md5 values of decoded frames are written in `*.frames.md5`. For instance,
`test-25fps.h264.frames.md5` for `test-25fps.h264`. Note that if there is already
the `.frames.md5` file, this overwrites the file.
ffmpeg with `-f framemd5` can be used for this purpose. For instance,
`ffmpeg -i test-25fps.h264 -f framemd5 test-25fps.frames.md5`
## Basic VEA usage
......
......@@ -75,10 +75,6 @@ void VideoFrameValidator::Destroy() {
DCHECK_EQ(0u, num_frames_validating_);
}
const std::vector<std::string>& VideoFrameValidator::GetFrameChecksums() const {
return frame_checksums_;
}
std::vector<VideoFrameValidator::MismatchedFrameInfo>
VideoFrameValidator::GetMismatchedFramesInfo() const {
base::AutoLock auto_lock(frame_validator_lock_);
......@@ -140,7 +136,6 @@ void VideoFrameValidator::ProcessVideoFrameTask(
std::string computed_md5 = ComputeMD5FromVideoFrame(validated_frame.get());
base::AutoLock auto_lock(frame_validator_lock_);
frame_checksums_.push_back(computed_md5);
if (expected_frame_checksums_.size() > 0) {
LOG_IF(FATAL, frame_index >= expected_frame_checksums_.size())
......
......@@ -54,9 +54,6 @@ class VideoFrameValidator : public VideoFrameProcessor {
~VideoFrameValidator() override;
// Get the ordered list of calculated frame checksums.
const std::vector<std::string>& GetFrameChecksums() const;
// Returns information of frames that don't match golden md5 values.
// If there is no mismatched frame, returns an empty vector. This function is
// thread-safe.
......@@ -95,9 +92,6 @@ class VideoFrameValidator : public VideoFrameProcessor {
std::vector<MismatchedFrameInfo> mismatched_frames_
GUARDED_BY(frame_validator_lock_);
// The list of calculated MD5 frame checksums.
std::vector<std::string> frame_checksums_ GUARDED_BY(frame_validator_lock_);
// The list of expected MD5 frame checksums.
const std::vector<std::string> expected_frame_checksums_;
......
......@@ -1693,60 +1693,6 @@ TEST_F(VideoDecodeAcceleratorTest, NoCrash) {
WaitUntilDecodeFinish(notes_[0].get());
}
#if defined(OS_CHROMEOS)
// This is the case only for generating md5 values of video frames on stream.
// This is disabled by default. To run this, you should run this test with
// --gtest_filter=VideoDecodeAcceleratorTest.DISABLED_GenMD5 and
// --gtest_also_run_disabled_tests
TEST_F(VideoDecodeAcceleratorTest, DISABLED_GenMD5) {
g_validate_frames = false;
g_calculate_checksums = true;
g_test_import = true;
ASSERT_EQ(test_video_files_.size(), 1u);
notes_.push_back(
std::make_unique<media::test::ClientStateNotification<ClientState>>());
const TestVideoFile* video_file = test_video_files_[0].get();
GLRenderingVDAClient::Config config;
config.frame_size = gfx::Size(video_file->width, video_file->height);
config.profile = video_file->profile;
config.fake_decoder = g_fake_decoder;
config.num_frames = video_file->num_frames;
auto video_frame_validator =
CreateAndInitializeVideoFrameValidator(video_file->file_name);
media::test::VideoFrameValidator* frame_validator =
video_frame_validator.get();
clients_.push_back(std::make_unique<GLRenderingVDAClient>(
std::move(config), video_file->data_str, &rendering_helper_,
std::move(video_frame_validator), nullptr, notes_[0].get()));
RenderingHelperParams helper_params;
helper_params.num_windows = 1;
InitializeRenderingHelper(helper_params);
CreateAndStartDecoder(clients_[0].get(), notes_[0].get());
ClientState last_state = WaitUntilDecodeFinish(notes_[0].get());
EXPECT_NE(CS_ERROR, last_state);
// Write out computed md5 values.
frame_validator->WaitUntilDone();
const std::vector<std::string>& frame_checksums =
frame_validator->GetFrameChecksums();
base::FilePath md5_file_path(video_file->file_name);
md5_file_path = md5_file_path.AddExtension(FILE_PATH_LITERAL(".frames.md5"));
base::File md5_file(md5_file_path, base::File::FLAG_CREATE_ALWAYS |
base::File::FLAG_WRITE |
base::File::FLAG_APPEND);
if (!md5_file.IsValid())
LOG(ERROR) << "Failed to create md5 file to write " << md5_file_path;
for (const std::string& frame_checksum : frame_checksums) {
md5_file.Write(0, frame_checksum.data(), frame_checksum.size());
md5_file.Write(0, "\n", 1);
}
g_test_import = false;
}
#endif
// TODO(fischman, vrk): add more tests! In particular:
// - Test life-cycle: Seek/Stop/Pause/Play for a single decoder.
// - Test alternate configurations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment