gst-plugins-bad: mpegtsdemux: Not apply various time the same PMT to a program when repetead
Thibault Saunier
tsaunier at kemper.freedesktop.org
Fri Feb 17 07:20:20 PST 2012
Module: gst-plugins-bad
Branch: master
Commit: 8cb0e87f5623836ddc361eb91dcf9b50b48048e7
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=8cb0e87f5623836ddc361eb91dcf9b50b48048e7
Author: Thibault Saunier <thibault.saunier at collabora.com>
Date: Fri Feb 17 12:15:27 2012 -0300
mpegtsdemux: Not apply various time the same PMT to a program when repetead
Sometimes their are several times the same PMT applying to a same program in a stream,
tsdemux was totally baffled when this was happening, we now keep the one we
already applied so it works properly.
---
gst/mpegtsdemux/mpegtsbase.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index 363eeaf..1232338 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -953,6 +953,8 @@ mpegts_base_handle_psi (MpegTSBase * base, MpegTSPacketizerSection * section)
{
gboolean res = TRUE;
GstStructure *structure = NULL;
+ gint program_number;
+ MpegTSBaseProgram *program = NULL;
/* table ids 0x70 - 0x73 do not have a crc */
if (G_LIKELY (section->table_id < 0x70 || section->table_id > 0x73)) {
@@ -982,10 +984,22 @@ mpegts_base_handle_psi (MpegTSBase * base, MpegTSPacketizerSection * section)
break;
case 0x02:
structure = mpegts_packetizer_parse_pmt (base->packetizer, section);
- if (G_LIKELY (structure))
+ if (G_UNLIKELY (structure == NULL))
+ return FALSE;
+
+ gst_structure_id_get (structure, QUARK_PROGRAM_NUMBER, G_TYPE_UINT,
+ &program_number, NULL);
+ program = mpegts_base_get_program (base, program_number);
+
+ /* We already have the same PMT for the current program in use, so we do
+ * not need to reset it */
+ if (program && program->active && program->pmt_pid == section->pid) {
+ GST_DEBUG ("Already have the PMT %u for program %i, not applying again",
+ program->pmt_pid, program_number);
+ res = TRUE;
+ } else {
mpegts_base_apply_pmt (base, section->pid, structure);
- else
- res = FALSE;
+ }
break;
case 0x40:
More information about the gstreamer-commits
mailing list