v4l2codecs: Test ioctl return value and errno

Fix error testing when using V4L2_FMTDESC_FLAG_ENUM_ALL by using
both errno and the return value.

Fixes !7686 (merged)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7873>
This commit is contained in:
Benjamin Gaignard 2024-11-12 12:12:17 +01:00 committed by GStreamer Marge Bot
parent 2bbf095e5b
commit da02191411

View file

@ -539,7 +539,7 @@ gst_v4l2_decoder_enum_src_formats_full (GstV4l2Decoder * self,
ret = ioctl (self->video_fd, VIDIOC_ENUM_FMT, &fmtdesc); ret = ioctl (self->video_fd, VIDIOC_ENUM_FMT, &fmtdesc);
/* If the driver can't enumerate all the pixels formats /* If the driver can't enumerate all the pixels formats
* return empty caps */ * return empty caps */
if (enum_all && ret == -EINVAL) { if (enum_all && ret < 0 && errno == EINVAL) {
gst_caps_unref (caps); gst_caps_unref (caps);
return gst_static_caps_get (&default_src_caps); return gst_static_caps_get (&default_src_caps);
} }