From f6b91fe30317cd0163b3d35c7528eae5892f5af2 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Wed, 12 Jun 2019 02:42:42 +1000 Subject: [PATCH] splitmuxsrc: Protect initial pad configuration with the object lock gst_splitmux_src_activate_part() configures the pad information before starting the pad task, but occasionally the changes it makes to the pad are not seen in the pad task because they're not protected by the right locking. Use the pad's object lock to protect those variables. --- gst/multifile/gstsplitmuxsrc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/multifile/gstsplitmuxsrc.c b/gst/multifile/gstsplitmuxsrc.c index c7e8a14954..3e7067d9e6 100644 --- a/gst/multifile/gstsplitmuxsrc.c +++ b/gst/multifile/gstsplitmuxsrc.c @@ -731,7 +731,7 @@ gst_splitmux_pad_loop (GstPad * pad) SplitMuxSrcPad *splitpad = (SplitMuxSrcPad *) (pad); GstSplitMuxSrc *splitmux = (GstSplitMuxSrc *) gst_pad_get_parent (pad); GstDataQueueItem *item = NULL; - GstSplitMuxPartReader *reader = splitpad->reader; + GstSplitMuxPartReader *reader; GstPad *part_pad; GstFlowReturn ret; @@ -741,6 +741,7 @@ gst_splitmux_pad_loop (GstPad * pad) return; } part_pad = gst_object_ref (splitpad->part_pad); + reader = splitpad->reader; GST_OBJECT_UNLOCK (splitpad); GST_LOG_OBJECT (splitpad, "Popping data queue item from %" GST_PTR_FORMAT @@ -816,6 +817,7 @@ gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux, guint part, for (cur = g_list_first (splitmux->pads); cur != NULL; cur = g_list_next (cur)) { SplitMuxSrcPad *splitpad = (SplitMuxSrcPad *) (cur->data); + GST_OBJECT_LOCK (splitpad); splitpad->cur_part = part; splitpad->reader = splitmux->parts[splitpad->cur_part]; if (splitpad->part_pad) @@ -823,6 +825,7 @@ gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux, guint part, splitpad->part_pad = gst_splitmux_part_reader_lookup_pad (splitpad->reader, (GstPad *) (splitpad)); + GST_OBJECT_UNLOCK (splitpad); /* Make sure we start with a DISCONT */ splitpad->set_next_discont = TRUE;