mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
tsdemux: Make sure old streams are drained before switching
Before we add any streams, make sure we drain all streams. This ensures there's consistency that only "new" data will be pushed on buffers once the new pads are added https://bugzilla.gnome.org/show_bug.cgi?id=750402
This commit is contained in:
parent
14e6d2d427
commit
7336294635
1 changed files with 12 additions and 1 deletions
|
@ -1704,7 +1704,7 @@ activate_pad_for_stream (GstTSDemux * tsdemux, TSDemuxStream * stream)
|
|||
gst_pad_push_event (stream->pad, gst_event_new_gap (0, 0));
|
||||
}
|
||||
} else if (((MpegTSBaseStream *) stream)->stream_type != 0xff) {
|
||||
GST_WARNING_OBJECT (tsdemux,
|
||||
GST_DEBUG_OBJECT (tsdemux,
|
||||
"stream %p (pid 0x%04x, type:0x%02x) has no pad", stream,
|
||||
((MpegTSBaseStream *) stream)->pid,
|
||||
((MpegTSBaseStream *) stream)->stream_type);
|
||||
|
@ -1806,6 +1806,17 @@ gst_ts_demux_program_started (MpegTSBase * base, MpegTSBaseProgram * program)
|
|||
demux->segment_event = NULL;
|
||||
}
|
||||
|
||||
/* DRAIN ALL STREAMS FIRST ! */
|
||||
if (demux->previous_program) {
|
||||
GList *tmp;
|
||||
GST_DEBUG_OBJECT (demux, "Draining previous program");
|
||||
for (tmp = demux->previous_program->stream_list; tmp; tmp = tmp->next) {
|
||||
TSDemuxStream *stream = (TSDemuxStream *) tmp->data;
|
||||
if (stream->pad)
|
||||
gst_ts_demux_push_pending_data (demux, stream);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add all streams, then fire no-more-pads */
|
||||
for (tmp = program->stream_list; tmp; tmp = tmp->next) {
|
||||
TSDemuxStream *stream = (TSDemuxStream *) tmp->data;
|
||||
|
|
Loading…
Reference in a new issue