mpegtsdemux: do not try to parse packets containing section data as PES

This commit is contained in:
Janne Grunau 2011-02-21 11:44:01 +01:00 committed by Edward Hervey
parent bf046719a2
commit 3ebc8a43e2
2 changed files with 9 additions and 6 deletions

View file

@ -733,9 +733,9 @@ mpegts_base_apply_pmt (MpegTSBase * base,
gst_structure_id_get (stream, QUARK_PID, G_TYPE_UINT, &pid, gst_structure_id_get (stream, QUARK_PID, G_TYPE_UINT, &pid,
QUARK_STREAM_TYPE, G_TYPE_UINT, &stream_type, NULL); QUARK_STREAM_TYPE, G_TYPE_UINT, &stream_type, NULL);
base->is_pes[pid] = TRUE;
mpegts_base_program_add_stream (base, program, mpegts_base_program_add_stream (base, program,
(guint16) pid, (guint8) stream_type, stream); (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 */ /* we need to push section packet downstream */
res = mpegts_base_push (base, &packet, &section); res = mpegts_base_push (base, &packet, &section);
} else { } else if (base->is_pes[packet.pid]) {
/* push the packet downstream */ /* push the packet downstream */
res = mpegts_base_push (base, &packet, NULL); res = mpegts_base_push (base, &packet, NULL);
} }

View file

@ -424,7 +424,7 @@ done:
} }
static GstPad * static GstPad *
create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream, create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
MpegTSBaseProgram * program) MpegTSBaseProgram * program)
{ {
TSDemuxStream *stream = (TSDemuxStream *) bstream; TSDemuxStream *stream = (TSDemuxStream *) bstream;
@ -530,6 +530,7 @@ create_pad_for_stream (GstTSDemux * demux, MpegTSBaseStream * bstream,
case ST_DSMCC_B: case ST_DSMCC_B:
case ST_DSMCC_C: case ST_DSMCC_C:
case ST_DSMCC_D: case ST_DSMCC_D:
base->is_pes[bstream->pid] = FALSE;
break; break;
case ST_AUDIO_AAC: case ST_AUDIO_AAC:
template = gst_static_pad_template_get (&audio_template); template = gst_static_pad_template_get (&audio_template);
@ -681,13 +682,12 @@ static void
gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * bstream, gst_ts_demux_stream_added (MpegTSBase * base, MpegTSBaseStream * bstream,
MpegTSBaseProgram * program) MpegTSBaseProgram * program)
{ {
GstTSDemux *tsdemux = (GstTSDemux *) base;
TSDemuxStream *stream = (TSDemuxStream *) bstream; TSDemuxStream *stream = (TSDemuxStream *) bstream;
if (!stream->pad) { if (!stream->pad) {
/* Create the pad */ /* Create the pad */
if (bstream->stream_type != 0xff) 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->pts = GST_CLOCK_TIME_NONE;
} }
stream->flow_return = GST_FLOW_OK; stream->flow_return = GST_FLOW_OK;
@ -1161,7 +1161,8 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream)
data += 4; data += 4;
length -= 4; length -= 4;
if (G_UNLIKELY ((psc_stid & 0xffffff00) != 0x00000100)) { 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; goto discont;
} }
stid = psc_stid & 0x000000ff; stid = psc_stid & 0x000000ff;
@ -1441,6 +1442,8 @@ gst_ts_demux_handle_packet (GstTSDemux * demux, TSDemuxStream * stream,
if (section) { if (section) {
GST_DEBUG ("section complete:%d, buffer size %d", GST_DEBUG ("section complete:%d, buffer size %d",
section->complete, GST_BUFFER_SIZE (section->buffer)); section->complete, GST_BUFFER_SIZE (section->buffer));
gst_buffer_unref (packet->buffer);
return res;
} }
if (G_UNLIKELY (packet->payload_unit_start_indicator)) if (G_UNLIKELY (packet->payload_unit_start_indicator))