v4l2codecs: decoder: Fixed unset dimension in caps

When the driver does not implement ENUM_FRMESIZE for some specific
formats, the caps limiting the sizes may endup empty, which results in
assuming the driver can scale to any sizes.

Ensure that the original size is in the caps to prevent this assumption.
This happens with Hantro drive, since it only reply to that call if the
format is postprocessed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7849>
This commit is contained in:
Nicolas Dufresne 2024-11-08 16:22:16 -05:00 committed by GStreamer Marge Bot
parent 1a9841582d
commit 61d2231c58

View file

@ -448,7 +448,9 @@ gst_v4l2_decoder_probe_caps_for_format (GstV4l2Decoder * self,
caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING,
gst_video_format_to_string (format), NULL); gst_video_format_to_string (format), NULL);
size_caps = gst_caps_new_empty (); size_caps = gst_caps_new_simple ("video/x-raw",
"width", G_TYPE_INT, unscaled_width,
"height", G_TYPE_INT, unscaled_height, NULL);
while ((tmp = gst_v4l2_decoder_enum_size_for_format (self, pixelformat, while ((tmp = gst_v4l2_decoder_enum_size_for_format (self, pixelformat,
index++, unscaled_width, unscaled_height))) { index++, unscaled_width, unscaled_height))) {
size_caps = gst_caps_merge (size_caps, tmp); size_caps = gst_caps_merge (size_caps, tmp);