gst-plugins-bad: mpegtsdemux: do not try to parse packets containing section data as PES
Edward Hervey
bilboed at kemper.freedesktop.org
Mon Mar 21 11:33:48 PDT 2011
Module: gst-plugins-bad
Branch: master
Commit: 3ebc8a43e2ed24a26549dde62a7cb74e4aa8e037
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=3ebc8a43e2ed24a26549dde62a7cb74e4aa8e037
Author: Janne Grunau <janne.grunau at collabora.co.uk>
Date: Mon Feb 21 11:44:01 2011 +0100
mpegtsdemux: do not try to parse packets containing section data as PES
---
gst/mpegtsdemux/mpegtsbase.c | 4 ++--
gst/mpegtsdemux/tsdemux.c | 11 +++++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index 44a31a8..c7f33c9 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -733,9 +733,9 @@ mpegts_base_apply_pmt (MpegTSBase * base,
gst_structure_id_get (stream, QUARK_PID, G_TYPE_UINT, &pid,
QUARK_STREAM_TYPE, G_TYPE_UINT, &stream_type, NULL);
+ base->is_pes[pid] = TRUE;
mpegts_base_program_add_stream (base, program,
(guint16) pid, (guint8) stream_type, stream);
- base->is_pes[pid] = TRUE;
}
@@ -1079,7 +1079,7 @@ mpegts_base_chain (GstPad * pad, GstBuffer * buf)
/* we need to push section packet downstream */
res = mpegts_base_push (base, &packet, §ion);
- } else {
+ } else if (base->is_pes[packet.pid]) {
/* push the packet downstream */
res = mpegts_base_push (base, &packet, NULL);
}
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 0220ea4..2effb6d 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -424,7 +424,7 @@ done:
}
static GstPad *
-create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream,
+create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
MpegTSBaseProgram * program)
{
TSDemuxStream *stream = (TSDemuxStream *) bstream;
@@ -530,6 +530,7 @@ create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream,
case ST_DSMCC_B:
case ST_DSMCC_C:
case ST_DSMCC_D:
+ base->is_pes[bstream->pid] = FALSE;
break;
case ST_AUDIO_AAC:
template = gst_static_pad_template_get (&audio_template);
@@ -681,13 +682,12 @@ static void
gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * bstream,
MpegTSBaseProgram * program)
{
- GstTSDemux *tsdemux = (GstTSDemux *) base;
TSDemuxStream *stream = (TSDemuxStream *) bstream;
if (!stream->pad) {
/* Create the pad */
if (bstream->stream_type != 0xff)
- stream->pad = create_pad_for_stream (tsdemux, bstream, program);
+ stream->pad = create_pad_for_stream (base, bstream, program);
stream->pts = GST_CLOCK_TIME_NONE;
}
stream->flow_return = GST_FLOW_OK;
@@ -1161,7 +1161,8 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream)
data += 4;
length -= 4;
if (G_UNLIKELY ((psc_stid & 0xffffff00) != 0x00000100)) {
- GST_WARNING ("WRONG PACKET START CODE !");
+ GST_WARNING ("WRONG PACKET START CODE! pid: 0x%x stream_type: 0x%x",
+ stream->stream.pid, stream->stream.stream_type);
goto discont;
}
stid = psc_stid & 0x000000ff;
@@ -1441,6 +1442,8 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream,
if (section) {
GST_DEBUG ("section complete:%d, buffer size %d",
section->complete, GST_BUFFER_SIZE (section->buffer));
+ gst_buffer_unref (packet->buffer);
+ return res;
}
if (G_UNLIKELY (packet->payload_unit_start_indicator))
More information about the gstreamer-commits
mailing list