mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
udpsrc: protect cancellable from unlock/unlock_stop race
Protect cancellable from simultaneous unlock and unlock_stop calls from basesrc class. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7885>
This commit is contained in:
parent
591ddfe203
commit
ff14e1a9e3
1 changed files with 5 additions and 2 deletions
|
@ -932,8 +932,7 @@ gst_udpsrc_free_cancellable (GstUDPSrc * src)
|
|||
g_cancellable_release_fd (src->cancellable);
|
||||
src->made_cancel_fd = FALSE;
|
||||
}
|
||||
g_object_unref (src->cancellable);
|
||||
src->cancellable = NULL;
|
||||
g_clear_object (&src->cancellable);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
@ -1954,7 +1953,9 @@ gst_udpsrc_unlock (GstBaseSrc * bsrc)
|
|||
src = GST_UDPSRC (bsrc);
|
||||
|
||||
GST_LOG_OBJECT (src, "Flushing");
|
||||
GST_OBJECT_LOCK (src);
|
||||
g_cancellable_cancel (src->cancellable);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1968,8 +1969,10 @@ gst_udpsrc_unlock_stop (GstBaseSrc * bsrc)
|
|||
|
||||
GST_LOG_OBJECT (src, "No longer flushing");
|
||||
|
||||
GST_OBJECT_LOCK (src);
|
||||
gst_udpsrc_free_cancellable (src);
|
||||
gst_udpsrc_create_cancellable (src);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue