media/ffmpeg: more detailed error message

Knowing the dimensions is helpful here - add this information.

BUG=None
TEST=cargo build --features "video-decoder,vaapi,ffmpeg,libvda-stub"

Change-Id: I0c6f03d6fd05aee36233b2609a3e9da145decec8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5598601
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Alexandre Courbot 2024-05-27 16:14:20 +09:00 committed by crosvm LUCI
parent ac6fe3e31c
commit c6f30e4d46

View file

@ -10,6 +10,7 @@ use thiserror::Error as ThisError;
use crate::avcodec::AvError;
use crate::avcodec::AvFrame;
use crate::avcodec::Dimensions;
use crate::ffi;
/// A struct able to copy a decoded `AvFrame` into an `OutputBuffer`'s memory, converting the pixel
@ -27,8 +28,8 @@ pub enum ConversionError {
frame: ffi::AVPixelFormat,
converter: ffi::AVPixelFormat,
},
#[error("source AvFrame's dimension does not match destination's")]
DimensionMismatch,
#[error("source AvFrame's dimension {0:?} does not match destination's {1:?}")]
DimensionMismatch(Dimensions, Dimensions),
#[error("destination AvFrame needs to be refcounted with refcount=1")]
NotWritable,
#[error("error during conversion with libswscale: {0}")]
@ -107,7 +108,10 @@ impl SwConverter {
}
if src.dimensions() != dst.dimensions() {
return Err(ConversionError::DimensionMismatch);
return Err(ConversionError::DimensionMismatch(
src.dimensions(),
dst.dimensions(),
));
}
if !dst.is_writable() {