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.
This commit is contained in:
Jan Schmidt 2019-06-12 02:42:42 +10:00
parent 715c6896a2
commit f6b91fe303

View file

@ -731,7 +731,7 @@ gst_splitmux_pad_loop (GstPad * pad)
SplitMuxSrcPad *splitpad = (SplitMuxSrcPad *) (pad); SplitMuxSrcPad *splitpad = (SplitMuxSrcPad *) (pad);
GstSplitMuxSrc *splitmux = (GstSplitMuxSrc *) gst_pad_get_parent (pad); GstSplitMuxSrc *splitmux = (GstSplitMuxSrc *) gst_pad_get_parent (pad);
GstDataQueueItem *item = NULL; GstDataQueueItem *item = NULL;
GstSplitMuxPartReader *reader = splitpad->reader; GstSplitMuxPartReader *reader;
GstPad *part_pad; GstPad *part_pad;
GstFlowReturn ret; GstFlowReturn ret;
@ -741,6 +741,7 @@ gst_splitmux_pad_loop (GstPad * pad)
return; return;
} }
part_pad = gst_object_ref (splitpad->part_pad); part_pad = gst_object_ref (splitpad->part_pad);
reader = splitpad->reader;
GST_OBJECT_UNLOCK (splitpad); GST_OBJECT_UNLOCK (splitpad);
GST_LOG_OBJECT (splitpad, "Popping data queue item from %" GST_PTR_FORMAT 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); for (cur = g_list_first (splitmux->pads);
cur != NULL; cur = g_list_next (cur)) { cur != NULL; cur = g_list_next (cur)) {
SplitMuxSrcPad *splitpad = (SplitMuxSrcPad *) (cur->data); SplitMuxSrcPad *splitpad = (SplitMuxSrcPad *) (cur->data);
GST_OBJECT_LOCK (splitpad);
splitpad->cur_part = part; splitpad->cur_part = part;
splitpad->reader = splitmux->parts[splitpad->cur_part]; splitpad->reader = splitmux->parts[splitpad->cur_part];
if (splitpad->part_pad) if (splitpad->part_pad)
@ -823,6 +825,7 @@ gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux, guint part,
splitpad->part_pad = splitpad->part_pad =
gst_splitmux_part_reader_lookup_pad (splitpad->reader, gst_splitmux_part_reader_lookup_pad (splitpad->reader,
(GstPad *) (splitpad)); (GstPad *) (splitpad));
GST_OBJECT_UNLOCK (splitpad);
/* Make sure we start with a DISCONT */ /* Make sure we start with a DISCONT */
splitpad->set_next_discont = TRUE; splitpad->set_next_discont = TRUE;