From b3ef72f2eb49be3dcc7a103635e6fe864e7f7072 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Sun, 12 Jun 2011 11:27:30 +0200 Subject: [PATCH] tsdemux: Don't free unexistent PAT And cleanup find_timestamps a bit --- gst/mpegtsdemux/tsdemux.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index e001e8b312..b602ab7c14 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -1654,6 +1654,12 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) /* Search for the first PCRs */ ret = process_pcr (base, base->first_pat_offset, &initial, 10, TRUE); + + if (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED) { + GST_WARNING ("Problem getting initial PCRs"); + goto beach; + } + mpegts_packetizer_clear (base->packetizer); /* Remove current program so we ensure looking for a PAT when scanning the * for the final PCR */ @@ -1661,11 +1667,6 @@ find_timestamps (MpegTSBase * base, guint64 initoff, guint64 * offset) base->pat = NULL; mpegts_base_remove_program (base, demux->current_program_number); - if (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED) { - GST_WARNING ("Problem getting initial PCRs"); - goto beach; - } - /* Find end position */ if (G_UNLIKELY (!gst_pad_query_peer_duration (base->sinkpad, &format, &total_bytes) || format != GST_FORMAT_BYTES)) { @@ -1718,8 +1719,10 @@ beach: mpegts_packetizer_clear (base->packetizer); /* Remove current program */ - gst_structure_free (base->pat); - base->pat = NULL; + if (base->pat) { + gst_structure_free (base->pat); + base->pat = NULL; + } mpegts_base_remove_program (base, demux->current_program_number); return ret;