mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 08:41:07 +00:00
v4l2src: fix cannot reuse current caps when fixate caps in negotiation
when regotiation happens, v4l2src will check if it can reuse current caps, but we need check if current caps is subset of all query caps from downstream instead of check it with query caps one by one. Assuming that the current caps is not the subset of first caps from query caps, it will go to try fmt. when try fmt success, v4l2src will make pending_set_fmt to TRUE and going to reset. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4500>
This commit is contained in:
parent
ceb0aca906
commit
1c488626da
1 changed files with 9 additions and 8 deletions
|
@ -585,6 +585,14 @@ gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps,
|
||||||
* enumerate the possibilities */
|
* enumerate the possibilities */
|
||||||
caps = gst_caps_normalize (caps);
|
caps = gst_caps_normalize (caps);
|
||||||
|
|
||||||
|
/* try hard to avoid TRY_FMT since some UVC camera just crash when this
|
||||||
|
* is called at run-time. */
|
||||||
|
if (gst_v4l2_object_caps_is_subset (obj, caps)) {
|
||||||
|
fcaps = gst_v4l2_object_get_current_caps (obj);
|
||||||
|
GST_DEBUG_OBJECT (basesrc, "reuse current caps %" GST_PTR_FORMAT, fcaps);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < gst_caps_get_size (caps); ++i) {
|
for (i = 0; i < gst_caps_get_size (caps); ++i) {
|
||||||
gst_v4l2_clear_error (&error);
|
gst_v4l2_clear_error (&error);
|
||||||
if (fcaps)
|
if (fcaps)
|
||||||
|
@ -592,14 +600,6 @@ gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps,
|
||||||
|
|
||||||
fcaps = gst_caps_copy_nth (caps, i);
|
fcaps = gst_caps_copy_nth (caps, i);
|
||||||
|
|
||||||
/* try hard to avoid TRY_FMT since some UVC camera just crash when this
|
|
||||||
* is called at run-time. */
|
|
||||||
if (gst_v4l2_object_caps_is_subset (obj, fcaps)) {
|
|
||||||
gst_caps_unref (fcaps);
|
|
||||||
fcaps = gst_v4l2_object_get_current_caps (obj);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Just check if the format is acceptable, once we know
|
/* Just check if the format is acceptable, once we know
|
||||||
* no buffers should be outstanding we try S_FMT.
|
* no buffers should be outstanding we try S_FMT.
|
||||||
*
|
*
|
||||||
|
@ -633,6 +633,7 @@ gst_v4l2src_fixate (GstBaseSrc * basesrc, GstCaps * caps,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (basesrc, "fixated caps %" GST_PTR_FORMAT, fcaps);
|
GST_DEBUG_OBJECT (basesrc, "fixated caps %" GST_PTR_FORMAT, fcaps);
|
||||||
|
|
Loading…
Reference in a new issue