mpegts: Don't add non-padded streams to collection on updates

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>
This commit is contained in:
Edward Hervey 2020-12-09 09:14:12 +01:00 committed by Edward Hervey
parent 3cb32df838
commit fe6ae27046
2 changed files with 5 additions and 2 deletions

View 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));
}

View file

@ -65,6 +65,7 @@ struct _MpegTSBaseStream
GstMpegtsPMTStream *stream;
GstStream *stream_object;
gboolean in_collection;
gchar *stream_id;
};