From cc40d49beda0eaf0b8acd64fb16342c2832ce453 Mon Sep 17 00:00:00 2001 From: Josep Torra Date: Sat, 10 Nov 2012 20:30:13 +0100 Subject: [PATCH] mpegtsbase: flush in FLUSH_STOP to avoid race conditions Ensure the chain is not running before reset the state to avoid race conditions and random corruptions downstream. Also fixes segfaults in the packetizer due wrong available values that causes gst_adapter_map to return a NULL pointer. --- gst/mpegtsdemux/mpegtsbase.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index d6bd41049b..e8db15bbce 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -1361,14 +1361,13 @@ mpegts_base_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) /* FIXME, do something */ gst_event_unref (event); break; - case GST_EVENT_FLUSH_START: + case GST_EVENT_FLUSH_STOP: + res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event); mpegts_packetizer_flush (base->packetizer); mpegts_base_flush (base); - res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event); - break; - case GST_EVENT_FLUSH_STOP: gst_segment_init (&base->segment, GST_FORMAT_UNDEFINED); base->seen_pat = FALSE; + break; /* Passthrough */ default: res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);