v4l2object: Use active resolution during fallback colorspace probe

For legacy drivers that don't implement ENUM_FRAMESIZE, use active
resolution to probe colorspace. This can improve the accuracy of the
result when the colorspace depends on the resolution. This fixes a
wrong colorspace issue on board with vendor bsp at resolution 2560x1440.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/830>
This commit is contained in:
Hou Qi 2020-12-11 11:24:14 +08:00
parent 6d4dcb430d
commit ff1dd307f2

View file

@ -2950,9 +2950,19 @@ default_frame_sizes:
pixelformat);
if (!v4l2object->skip_try_fmt_probes) {
gint probed_w, probed_h;
if (v4l2object->info.width >= min_w && v4l2object->info.width <= max_w &&
v4l2object->info.height >= min_h
&& v4l2object->info.height <= max_h) {
probed_w = v4l2object->info.width;
probed_h = v4l2object->info.height;
} else {
probed_w = max_w;
probed_h = max_h;
}
/* We could consider to check colorspace for min too, in case it depends on
* the size. But in this case, min and max could not be enough */
gst_v4l2_object_add_colorspace (v4l2object, tmp, max_w, max_h,
gst_v4l2_object_add_colorspace (v4l2object, tmp, probed_w, probed_h,
pixelformat);
}