transcodebin: Accept more than one stream

Look-up the stream matching the given ID also after building the stream list
from the received collection. Without this change the transcoder would discard
the second incoming stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1151>
This commit is contained in:
Philippe Normand 2020-10-25 18:04:05 +00:00 committed by GStreamer Merge Bot
parent b254c0d5fe
commit 88c96789bf

View file

@ -524,16 +524,18 @@ select_stream_cb (GstElement * decodebin,
{
gint i;
gboolean transcode_stream = FALSE;
guint len = 0;
GST_OBJECT_LOCK (self);
if (self->transcoding_streams->len) {
GST_OBJECT_UNLOCK (self);
len = self->transcoding_streams->len;
GST_OBJECT_UNLOCK (self);
if (len) {
transcode_stream =
find_stream (self, gst_stream_get_stream_id (stream), NULL) != NULL;
goto done;
if (transcode_stream)
goto done;
}
GST_OBJECT_UNLOCK (self);
for (i = 0; i < gst_stream_collection_get_size (collection); i++) {
GstStream *tmpstream = gst_stream_collection_get_stream (collection, i);
@ -555,6 +557,15 @@ select_stream_cb (GstElement * decodebin,
}
}
GST_OBJECT_LOCK (self);
len = self->transcoding_streams->len;
GST_OBJECT_UNLOCK (self);
if (len) {
transcode_stream =
find_stream (self, gst_stream_get_stream_id (stream), NULL) != NULL;
}
done:
if (!transcode_stream)
GST_INFO_OBJECT (self, "Discarding stream: %" GST_PTR_FORMAT, stream);