Commit 23267ae4 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Chromium LUCI CQ

media/gpu: Reject non 8 bit stream in VaapiVDA/V4L2SVD(A)

No existing ChromeOS arm device supports non 8 bit stream
decoding. VaapiVideoDecodeAccelerator implementation doesn't
support non 8 bit stream decoding. We have relied on underlying
implementations (e.g. drivers and firmware) to filter non 8 bit
streams. AcceleratedVideoDecoder has a getter function for the
bit depth of an input stream. This CL filters out non 8
bit streams in chrome by calling the getter function.

Bug: b:174798524
Test: video_decode_accelerator_tests test-25fps.vp9_2 on scarlet and atlas
Change-Id: I9071649740cd0ddab889887f09cabf598d38ec09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576298
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836028}
parent 260322d3
...@@ -1075,6 +1075,12 @@ void V4L2SliceVideoDecodeAccelerator::DecodeBufferTask() { ...@@ -1075,6 +1075,12 @@ void V4L2SliceVideoDecodeAccelerator::DecodeBufferTask() {
TRACE_EVENT_END0("media,gpu", "V4L2SVDA::DecodeBufferTask AVD::Decode"); TRACE_EVENT_END0("media,gpu", "V4L2SVDA::DecodeBufferTask AVD::Decode");
switch (res) { switch (res) {
case AcceleratedVideoDecoder::kConfigChange: case AcceleratedVideoDecoder::kConfigChange:
if (decoder_->GetBitDepth() != 8u) {
LOG(ERROR) << "Unsupported bit depth: "
<< base::strict_cast<int>(decoder_->GetBitDepth());
NOTIFY_ERROR(PLATFORM_FAILURE);
return;
}
if (!IsSupportedProfile(decoder_->GetProfile())) { if (!IsSupportedProfile(decoder_->GetProfile())) {
LOG(ERROR) << "Unsupported profile: " << decoder_->GetProfile(); LOG(ERROR) << "Unsupported profile: " << decoder_->GetProfile();
NOTIFY_ERROR(PLATFORM_FAILURE); NOTIFY_ERROR(PLATFORM_FAILURE);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h" #include "base/posix/eintr_wrapper.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "media/base/decode_status.h" #include "media/base/decode_status.h"
...@@ -379,6 +380,12 @@ bool V4L2StatelessVideoDecoderBackend::PumpDecodeTask() { ...@@ -379,6 +380,12 @@ bool V4L2StatelessVideoDecoderBackend::PumpDecodeTask() {
while (true) { while (true) {
switch (avd_->Decode()) { switch (avd_->Decode()) {
case AcceleratedVideoDecoder::kConfigChange: case AcceleratedVideoDecoder::kConfigChange:
if (avd_->GetBitDepth() != 8u) {
VLOGF(2) << "Unsupported bit depth: "
<< base::strict_cast<int>(avd_->GetBitDepth());
return false;
}
if (profile_ != avd_->GetProfile()) { if (profile_ != avd_->GetProfile()) {
DVLOGF(3) << "Profile is changed: " << profile_ << " -> " DVLOGF(3) << "Profile is changed: " << profile_ << " -> "
<< avd_->GetProfile(); << avd_->GetProfile();
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/numerics/ranges.h" #include "base/numerics/ranges.h"
#include "base/numerics/safe_conversions.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
...@@ -468,6 +469,11 @@ void VaapiVideoDecodeAccelerator::DecodeTask() { ...@@ -468,6 +469,11 @@ void VaapiVideoDecodeAccelerator::DecodeTask() {
switch (res) { switch (res) {
case AcceleratedVideoDecoder::kConfigChange: { case AcceleratedVideoDecoder::kConfigChange: {
RETURN_AND_NOTIFY_ON_FAILURE(
decoder_->GetBitDepth() == 8u,
"Unsupported bit depth: "
<< base::strict_cast<int>(decoder_->GetBitDepth()),
PLATFORM_FAILURE, );
// The visible rect should be a subset of the picture size. Otherwise, // The visible rect should be a subset of the picture size. Otherwise,
// the encoded stream is bad. // the encoded stream is bad.
const gfx::Size pic_size = decoder_->GetPicSize(); const gfx::Size pic_size = decoder_->GetPicSize();
......
...@@ -238,6 +238,7 @@ class VaapiVideoDecodeAcceleratorTest : public TestWithParam<TestParams>, ...@@ -238,6 +238,7 @@ class VaapiVideoDecodeAcceleratorTest : public TestWithParam<TestParams>,
EXPECT_CALL(*mock_decoder_, Decode()) EXPECT_CALL(*mock_decoder_, Decode())
.WillOnce(Return(AcceleratedVideoDecoder::kConfigChange)); .WillOnce(Return(AcceleratedVideoDecoder::kConfigChange));
EXPECT_CALL(*mock_decoder_, GetBitDepth()).WillOnce(Return(8u));
EXPECT_CALL(*mock_decoder_, GetPicSize()).WillOnce(Return(picture_size)); EXPECT_CALL(*mock_decoder_, GetPicSize()).WillOnce(Return(picture_size));
EXPECT_CALL(*mock_decoder_, GetVisibleRect()) EXPECT_CALL(*mock_decoder_, GetVisibleRect())
.WillOnce(Return(gfx::Rect(picture_size))); .WillOnce(Return(gfx::Rect(picture_size)));
......
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