mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 09:08:14 +00:00
tsdemux: Need to flush all streams when we receive a flush-start
This commit is contained in:
parent
cb30cd242c
commit
59c61209cf
3 changed files with 28 additions and 3 deletions
|
@ -1154,6 +1154,18 @@ gst_mpegts_base_handle_eos (MpegTSBase * base)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mpegts_base_flush (MpegTSBase * base)
|
||||
{
|
||||
MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
|
||||
|
||||
/* Call implementation */
|
||||
if (G_UNLIKELY (klass->flush == NULL))
|
||||
GST_WARNING_OBJECT (base, "Class doesn't have a 'flush' implementation !");
|
||||
else
|
||||
klass->flush (base);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mpegts_base_sink_event (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
|
@ -1191,6 +1203,7 @@ mpegts_base_sink_event (GstPad * pad, GstEvent * event)
|
|||
break;
|
||||
case GST_EVENT_FLUSH_START:
|
||||
mpegts_packetizer_flush (base->packetizer);
|
||||
mpegts_base_flush (base);
|
||||
res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
|
|
|
@ -162,6 +162,9 @@ struct _MpegTSBaseClass {
|
|||
/* seek is called to wait for seeking */
|
||||
GstFlowReturn (*seek) (MpegTSBase * base, GstEvent * event, guint16 pid);
|
||||
|
||||
/* flush all streams */
|
||||
void (*flush) (MpegTSBase * base);
|
||||
|
||||
/* signals */
|
||||
void (*pat_info) (GstStructure *pat);
|
||||
void (*pmt_info) (GstStructure *pmt);
|
||||
|
|
|
@ -188,6 +188,7 @@ static void gst_ts_demux_reset (MpegTSBase * base);
|
|||
static GstFlowReturn
|
||||
gst_ts_demux_push (MpegTSBase * base, MpegTSPacketizerPacket * packet,
|
||||
MpegTSPacketizerSection * section);
|
||||
static void gst_ts_demux_flush (MpegTSBase * base);
|
||||
static void
|
||||
gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * stream,
|
||||
MpegTSBaseProgram * program);
|
||||
|
@ -282,6 +283,7 @@ gst_ts_demux_class_init (GstTSDemuxClass * klass)
|
|||
ts_class->stream_removed = gst_ts_demux_stream_removed;
|
||||
ts_class->find_timestamps = GST_DEBUG_FUNCPTR (find_timestamps);
|
||||
ts_class->seek = GST_DEBUG_FUNCPTR (gst_ts_demux_do_seek);
|
||||
ts_class->flush = GST_DEBUG_FUNCPTR (gst_ts_demux_flush);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -882,9 +884,7 @@ gst_ts_demux_srcpad_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEEK:
|
||||
res = mpegts_base_handle_seek_event ((MpegTSBase *) demux, pad, event);
|
||||
if (res)
|
||||
demux->need_newsegment = TRUE;
|
||||
else
|
||||
if (!res)
|
||||
GST_WARNING ("seeking failed");
|
||||
gst_event_unref (event);
|
||||
break;
|
||||
|
@ -2278,6 +2278,15 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream,
|
|||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_ts_demux_flush (MpegTSBase * base)
|
||||
{
|
||||
GstTSDemux *demux = GST_TS_DEMUX_CAST (base);
|
||||
|
||||
demux->need_newsegment = TRUE;
|
||||
gst_ts_demux_flush_streams (demux);
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_ts_demux_push (MpegTSBase * base, MpegTSPacketizerPacket * packet,
|
||||
MpegTSPacketizerSection * section)
|
||||
|
|
Loading…
Reference in a new issue