From 3e88edfebcc2cd7ab92a9a26494fd272f63fda40 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Sun, 21 Jul 2013 21:41:13 -0400 Subject: [PATCH] pipeline: Check that the profile could actually be set on the encodebin Setting the profile on an encodebin can fail, and if that happens, there will be no profile set at all, we should return FALSE in GESPipeline when that happens --- ges/ges-pipeline.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ges/ges-pipeline.c b/ges/ges-pipeline.c index db67f31..08aa752 100644 --- a/ges/ges-pipeline.c +++ b/ges/ges-pipeline.c @@ -879,6 +879,7 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline, const gchar * output_uri, GstEncodingProfile * profile) { GError *err = NULL; + GstEncodingProfile *set_profile; g_return_val_if_fail (GES_IS_TIMELINE_PIPELINE (pipeline), FALSE); @@ -905,8 +906,17 @@ ges_pipeline_set_render_settings (GESPipeline * pipeline, g_object_set (pipeline->priv->encodebin, "avoid-reencoding", !(!(pipeline->priv->mode & TIMELINE_MODE_SMART_RENDER)), NULL); g_object_set (pipeline->priv->encodebin, "profile", profile, NULL); - pipeline->priv->profile = - (GstEncodingProfile *) gst_encoding_profile_ref (profile); + g_object_get (pipeline->priv->encodebin, "profile", &set_profile, NULL); + + if (set_profile == NULL) { + GST_ERROR_OBJECT (pipeline, "Profile %" GST_PTR_FORMAT " could no be set", + profile); + + return FALSE; + } + + /* We got a referencer when getting back the profile */ + pipeline->priv->profile = profile; return TRUE; } -- 2.7.4