summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2014-10-06 15:39:31 +0200
committerEdward Hervey <bilboed@bilboed.com>2015-03-11 10:39:37 +0100
commitb6b40c5ebed2298d7d044c96f4ddd8e103d4f902 (patch)
treeefd3563f15445aedd901431b02f0f724d35eee68
parent473dc528cf5f09239436c9ba416e734aaede6f06 (diff)
tsdemux: Flush packetizer on STREAM_START
Will force a re-scan of all sections, so that if it's really a different program, it will be detected and properly switched to
-rw-r--r--gst/mpegtsdemux/mpegtsbase.c1
-rw-r--r--gst/mpegtsdemux/mpegtspacketizer.c17
2 files changed, 14 insertions, 4 deletions
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index 0ca7216f0..5994341fe 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -1066,6 +1066,7 @@ mpegts_base_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);
break;
case GST_EVENT_STREAM_START:
+ mpegts_packetizer_flush (base->packetizer, TRUE);
gst_event_unref (event);
break;
case GST_EVENT_CAPS:
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c
index 372719da2..dca98906f 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.c
+++ b/gst/mpegtsdemux/mpegtspacketizer.c
@@ -230,9 +230,11 @@ mpegts_packetizer_stream_free (MpegTSPacketizerStream * stream)
mpegts_packetizer_clear_section (stream);
if (stream->section_data)
g_free (stream->section_data);
- g_slist_foreach (stream->subtables,
- (GFunc) mpegts_packetizer_stream_subtable_free, NULL);
- g_slist_free (stream->subtables);
+ if (stream->subtables) {
+ g_slist_foreach (stream->subtables,
+ (GFunc) mpegts_packetizer_stream_subtable_free, NULL);
+ g_slist_free (stream->subtables);
+ }
g_free (stream);
}
@@ -603,7 +605,14 @@ mpegts_packetizer_flush (MpegTSPacketizer2 * packetizer, gboolean hard)
if (packetizer->streams) {
for (i = 0; i < 8192; i++) {
if (packetizer->streams[i]) {
- mpegts_packetizer_clear_section (packetizer->streams[i]);
+ MpegTSPacketizerStream *stream = packetizer->streams[i];
+ mpegts_packetizer_clear_section (stream);
+ if (stream->subtables) {
+ g_slist_foreach (stream->subtables,
+ (GFunc) mpegts_packetizer_stream_subtable_free, NULL);
+ g_slist_free (stream->subtables);
+ stream->subtables = NULL;
+ }
}
}
}