Commit df72cfe5 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2: apply workarounds outside of stream parser

The stream parsing method should only do that - parse the stream.
Workarounds can be applied independently of it, so move them outside of
the method so we can move it around more easily.

BUG=b:149663704
TEST=vdatest passes on Hana.

Change-Id: I9f1305463424d14678f64d9056a54a5f761a39fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2130453
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarChih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755262}
parent 2e6b5faa
......@@ -940,6 +940,16 @@ void V4L2VideoDecodeAccelerator::DecodeBufferTask() {
buffer->data() + decoder_current_bitstream_buffer_->bytes_used;
const size_t data_size =
buffer->data_size() - decoder_current_bitstream_buffer_->bytes_used;
for (auto& workaround : workarounds_) {
auto result = workaround->Apply(data, data_size);
if (result == V4L2StatefulWorkaround::Result::NotifyError) {
LOG(ERROR) << "Failed applying a workaround";
NOTIFY_ERROR(PLATFORM_FAILURE);
return;
}
}
if (!AdvanceFrameFragment(data, data_size, &decoded_size)) {
LOG(ERROR) << "Invalid Stream";
NOTIFY_ERROR(UNREADABLE_INPUT);
......@@ -986,15 +996,6 @@ bool V4L2VideoDecodeAccelerator::AdvanceFrameFragment(const uint8_t* data,
size_t* endpos) {
DCHECK(decoder_thread_.task_runner()->BelongsToCurrentThread());
for (auto& workaround : workarounds_) {
auto result = workaround->Apply(data, size);
if (result == V4L2StatefulWorkaround::Result::NotifyError) {
LOG(ERROR) << "Failed doing a workaround";
NOTIFY_ERROR(PLATFORM_FAILURE);
return false;
}
}
if (video_profile_ >= H264PROFILE_MIN && video_profile_ <= H264PROFILE_MAX) {
// For H264, we need to feed HW one frame at a time. This is going to take
// some parsing of our input stream.
......
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