shmsrc: delay fd removal until there's no uses

This fixes the remaining race condition with the fd by delaying
the removal until last pipe ref.

Unexpected critical/warning: gst_poll_fd_has_error: assertion 'fd->fd
>= 0' failed

Stack trace:
gst_debug_get_stack_trace (gstinfo.c:2788)
gst_check_log_critical_func (gstcheck.c:281)
g_logv (/lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2:0x7fdd4efa0a40)
g_log (/lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2:0x7fdd4efa0c6b)
gst_poll_fd_has_error (gstpoll.c:1217)
gst_shm_src_create (gstshmsrc.c:364)
gst_push_src_create (gstpushsrc.c:131)
gst_base_src_get_range (gstbasesrc.c:2521)
gst_base_src_loop (gstbasesrc.c:2845)
gst_task_func (gsttask.c:328)
default_func (gsttaskpool.c:69)

https://bugzilla.gnome.org/show_bug.cgi?id=797203
This commit is contained in:
Josep Torra 2018-10-09 16:59:54 +02:00 committed by Olivier Crête
parent eb1665ff22
commit 498dc9a84d

View file

@ -277,10 +277,7 @@ gst_shm_src_stop_reading (GstShmSrc * self)
if (pipe) {
gst_shm_pipe_dec (pipe);
gst_poll_remove_fd (self->poll, &self->pollfd);
}
gst_poll_fd_init (&self->pollfd);
gst_poll_set_flushing (self->poll, TRUE);
}
@ -471,6 +468,10 @@ gst_shm_pipe_dec (GstShmPipe * pipe)
if (pipe->pipe)
sp_client_close (pipe->pipe);
gst_poll_remove_fd (pipe->src->poll, &pipe->src->pollfd);
gst_poll_fd_init (&pipe->src->pollfd);
GST_OBJECT_UNLOCK (pipe->src);
gst_object_unref (pipe->src);