v4l2object: clear old fds in poll when closing v4l2object

When reopening a v4l2 device, the v4l2object->poll will include some old fds,
which was assigned to this device before. If the pipeline opens multiple v4l2
devices, the old fd may been assigned to other v4l2 devices when reopening
devices.

This will cause the timing of the pipeline become confusing when polling devices,
leading functional abnormalities.

Therefore, when closing v4l2object, remove the old fds in poll to ensure that the
pipeline timing is normal.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5840>
This commit is contained in:
Chao Guo 2023-12-18 11:03:57 +09:00 committed by Tim-Philipp Müller
parent fc31fd09b3
commit 0587c2754e

View file

@ -969,6 +969,10 @@ gst_v4l2_object_close (GstV4l2Object * v4l2object)
v4l2object->channel = NULL;
}
/* remove old fd from poll */
if (v4l2object->poll)
gst_poll_remove_fd (v4l2object->poll, &v4l2object->pollfd);
return TRUE;
}