mpegts: Don't add non-padded streams to collection on updates
authorEdward Hervey <edward@centricular.com>
Wed, 9 Dec 2020 08:14:12 +0000 (09:14 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Mon, 14 Dec 2020 16:57:40 +0000 (17:57 +0100)
When carrying over existing GstStream to a new GstStreamCollection we need to
check whether they *actually* were being used in the previous collection.

This avoids adding unknown streams (metadata, PSI, etc...) to the collection on
updates.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1880>

gst/mpegtsdemux/mpegtsbase.c
gst/mpegtsdemux/mpegtsbase.h

index cf44020..bce8e8f 100644 (file)
@@ -607,9 +607,11 @@ mpegts_base_program_add_stream (MpegTSBase * base,
   program->stream_list = g_list_append (program->stream_list, bstream);
 
   if (klass->stream_added)
-    if (klass->stream_added (base, bstream, program))
+    if (klass->stream_added (base, bstream, program)) {
       gst_stream_collection_add_stream (program->collection,
           (GstStream *) gst_object_ref (bstream->stream_object));
+      bstream->in_collection = TRUE;
+    }
 
 
   return bstream;
@@ -692,7 +694,7 @@ mpegts_base_update_program (MpegTSBase * base, MpegTSBaseProgram * program,
   /* Copy over gststream that still exist into the collection */
   for (tmp = program->stream_list; tmp; tmp = tmp->next) {
     MpegTSBaseStream *stream = (MpegTSBaseStream *) tmp->data;
-    if (_stream_in_pmt (pmt, stream)) {
+    if (_stream_in_pmt (pmt, stream) && stream->in_collection) {
       gst_stream_collection_add_stream (program->collection,
           gst_object_ref (stream->stream_object));
     }
index fe92a8a..6b24128 100644 (file)
@@ -65,6 +65,7 @@ struct _MpegTSBaseStream
 
   GstMpegtsPMTStream *stream;
   GstStream          *stream_object;
+  gboolean            in_collection;
   gchar              *stream_id;
 };