mpegtsbase: Split up whether we saw a PAT and its offset

Fixes the issue with streams that don't set an offset on their buffers,
like those coming from hlsdemux.

Fixes #653481
This commit is contained in:
Edward Hervey 2011-07-14 22:08:56 +02:00
parent 592d7cbc15
commit a82483e367
2 changed files with 6 additions and 2 deletions

View file

@ -239,6 +239,7 @@ mpegts_base_init (MpegTSBase * base, MpegTSBaseClass * klass)
base->stream_size = sizeof (MpegTSBaseStream);
base->mode = BASE_MODE_STREAMING;
base->seen_pat = FALSE;
base->first_pat_offset = -1;
}
@ -705,7 +706,7 @@ mpegts_base_apply_pmt (MpegTSBase * base,
const GValue *value;
MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
if (G_UNLIKELY (base->first_pat_offset == -1)) {
if (G_UNLIKELY (base->seen_pat == FALSE)) {
GST_WARNING ("Got pmt without pat first. Returning");
/* remove the stream since we won't get another PMT otherwise */
mpegts_packetizer_remove_stream (base->packetizer, pmt_pid);
@ -832,7 +833,7 @@ mpegts_base_handle_psi (MpegTSBase * base, MpegTSPacketizerSection * section)
structure = mpegts_packetizer_parse_pat (base->packetizer, section);
if (G_LIKELY (structure)) {
mpegts_base_apply_pat (base, structure);
if (base->first_pat_offset == -1) {
if (base->seen_pat == FALSE) {
base->first_pat_offset = GST_BUFFER_OFFSET (section->buffer);
GST_DEBUG ("First PAT offset: %" G_GUINT64_FORMAT,

View file

@ -117,6 +117,9 @@ struct _MpegTSBase {
* by subclasses if they have their own MpegTSBaseStream subclasses */
gsize stream_size;
/* Whether we saw a PAT yet */
gboolean seen_pat;
/*Offset from the origin to the first PAT (pullmode) */
guint64 first_pat_offset;
};