video: decoder: vaapi: use max_{width|height} from CodedCaps if no value is returned

The max width and height from the coded side are the best approximation
for the max width and height of the raw side if the actual values are
not available in VA-API.

In particular, it's extremely unlikely to have 1x1 as acceptable values
for max_width and max_height.

BUG=b:214478588
TEST=cargo test -p devices --features=video-decoder,vaapi virtio::video::decoder::backend::vaapi::tests::test_get_capabilities -- --include-ignored

Change-Id: I6d9830b4da69f29f5e2e11c3fa688db4a7007726
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3901273
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Daniel Almeida 2022-09-15 18:22:48 -03:00 committed by crosvm LUCI
parent 49d746a47c
commit 23f0edd0ba

View file

@ -243,7 +243,7 @@ impl VaapiDecoder {
let max_width = match max_width.get(0) {
Some(libva::GenericValue::Integer(i)) => *i as u32,
Some(other) => panic!("Unexpected VAGenericValue {:?}", other),
None => 1,
None => coded_cap.max_width,
};
let max_height = config.query_surface_attributes_by_type(
@ -252,7 +252,7 @@ impl VaapiDecoder {
let max_height = match max_height.get(0) {
Some(libva::GenericValue::Integer(i)) => *i as u32,
Some(other) => panic!("Unexpected VAGenericValue {:?}", other),
None => 1,
None => coded_cap.max_height,
};
raw_caps.push(RawCap {