diff --git a/ext/ffmpeg/gstffmpegmux.c b/ext/ffmpeg/gstffmpegmux.c index 4fb7b27280..3afdf239ef 100644 --- a/ext/ffmpeg/gstffmpegmux.c +++ b/ext/ffmpeg/gstffmpegmux.c @@ -861,16 +861,17 @@ gst_ffmpegmux_register (GstPlugin * plugin) type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &typeinfo, 0); g_type_set_qdata (type, GST_FFMUX_PARAMS_QDATA, (gpointer) params); g_type_add_interface_static (type, GST_TYPE_TAG_SETTER, &tag_setter_info); - + } else { + gst_caps_replace (&srccaps, NULL); + gst_caps_replace (&audiosinkcaps, NULL); + gst_caps_replace (&videosinkcaps, NULL); } if (!gst_element_register (plugin, type_name, GST_RANK_NONE, type)) { g_free (type_name); - gst_caps_unref (srccaps); - if (audiosinkcaps) - gst_caps_unref (audiosinkcaps); - if (videosinkcaps) - gst_caps_unref (videosinkcaps); + gst_caps_replace (&srccaps, NULL); + gst_caps_replace (&audiosinkcaps, NULL); + gst_caps_replace (&videosinkcaps, NULL); return FALSE; }