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.
This commit is contained in:
Josep Torra 2012-11-10 20:30:13 +01:00
parent f17ebca62a
commit cc40d49bed

View file

@ -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);