tsdemux: Don't free unexistent PAT

And cleanup find_timestamps a bit
This commit is contained in:
Edward Hervey 2011-06-12 11:27:30 +02:00
parent e1a7d71184
commit b3ef72f2eb

View file

@ -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;