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/5820>
This commit is contained in:
Chao Guo 2023-12-18 11:03:57 +09:00 committed by GStreamer Marge Bot
parent 61d3f5c8e0
commit 2e75b8c8e9

View file

@ -985,6 +985,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;
}