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: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/198>
This commit is contained in:
Thibault Saunier 2020-07-03 16:52:06 -04:00
parent 834345b1c8
commit 0b05bb6587

View file

@ -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,14 +1105,33 @@ 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);
gst_encoding_profile_set_presence (tmpprofiles->data, 1);