From 0b05bb6587789fccbe66aa776364c7aa275a4144 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 3 Jul 2020 16:52:06 -0400 Subject: [PATCH] pipeline: Discard encoding profiles that don't match any track Otherwise we get a 'not linked' error and we should just help the user as we can here. If the user adds a new track, he should set a new encoding profile anyway. Part-of: --- ges/ges-pipeline.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/ges/ges-pipeline.c b/ges/ges-pipeline.c index 19fc004..09d89c6 100644 --- a/ges/ges-pipeline.c +++ b/ges/ges-pipeline.c @@ -1066,7 +1066,7 @@ ges_pipeline_set_timeline (GESPipeline * pipeline, GESTimeline * timeline) * result to * @profile: The encoding to use for rendering the #GESPipeline:timeline * - * Specifies the encoding to be used by the pipeline to render its + * Specifies encoding setting to be used by the pipeline to render its * #GESPipeline:timeline, and where the result should be written to. * * This method **must** be called before setting the pipeline mode to @@ -1105,13 +1105,32 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline, g_list_free_full (tracks, gst_object_unref); for (; tmpprofiles; tmpprofiles = tmpprofiles->next) { - if ((GST_IS_ENCODING_AUDIO_PROFILE (tmpprofiles->data) && n_audiotracks)) - n_audiotracks--; - else if ((GST_IS_ENCODING_VIDEO_PROFILE (tmpprofiles->data) - && n_videotracks)) - n_videotracks--; - else + if (!gst_encoding_profile_is_enabled (tmpprofiles->data)) + continue; + + if (GST_IS_ENCODING_AUDIO_PROFILE (tmpprofiles->data)) { + if (n_audiotracks) { + n_audiotracks--; + } else { + GST_INFO_OBJECT (pipeline, "No audio track but got an audio profile, " + " make it optional: %" GST_PTR_FORMAT, tmpprofiles); + gst_encoding_profile_set_presence (tmpprofiles->data, 0); + + continue; + } + } else if (GST_IS_ENCODING_VIDEO_PROFILE (tmpprofiles->data)) { + if (n_videotracks) { + n_videotracks--; + } else { + GST_INFO_OBJECT (pipeline, "No video track but got a video profile, " + " make it optional: %" GST_PTR_FORMAT, tmpprofiles); + gst_encoding_profile_set_presence (tmpprofiles->data, 0); + + continue; + } + } else { continue; + } GST_DEBUG_OBJECT (pipeline, "Setting presence to 1!"); gst_encoding_profile_set_single_segment (tmpprofiles->data, TRUE); -- 2.7.4