summaryrefslogtreecommitdiff
path: root/gst/mpegtsdemux/tsdemux.c
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2015-09-15 18:20:38 +0200
committerEdward Hervey <bilboed@bilboed.com>2015-12-02 14:15:04 +0100
commit7336294635d6066c812ca918e799a5ed21f177bb (patch)
tree67735e61a615fa94b88d2c3239367d9b607b9028 /gst/mpegtsdemux/tsdemux.c
parent14e6d2d42736a66cd83b08113f4a067943443b11 (diff)
downloadgstreamer-plugins-bad-7336294635d6066c812ca918e799a5ed21f177bb.tar.gz
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
Diffstat (limited to 'gst/mpegtsdemux/tsdemux.c')
-rw-r--r--gst/mpegtsdemux/tsdemux.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index aac68f2f9..f41d813fe 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -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;