From 6426145fc9f5b2586962a5aee7c94d8ea3081833 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 10 Mar 2012 09:15:43 +0100 Subject: [PATCH] registry: avoid copy when caps are fixed Avoid doing a useless copy when the caps are fixed and simplify will not do anything. --- gst/gstregistrychunks.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gst/gstregistrychunks.c b/gst/gstregistrychunks.c index 29feddc46d..dacacd4392 100644 --- a/gst/gstregistrychunks.c +++ b/gst/gstregistrychunks.c @@ -323,11 +323,14 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature) if (factory->caps) { /* we copy the caps here so we can simplify them before saving. This * is a lot faster when loading them later on */ - GstCaps *copy = gst_caps_copy (factory->caps); - - gst_caps_do_simplify (copy); - str = gst_caps_to_string (copy); - gst_caps_unref (copy); + if (!gst_caps_is_fixed (factory->caps)) { + GstCaps *copy = gst_caps_copy (factory->caps); + gst_caps_do_simplify (copy); + str = gst_caps_to_string (copy); + gst_caps_unref (copy); + } else { + str = gst_caps_to_string (factory->caps); + } gst_registry_chunks_save_string (list, str); } else { gst_registry_chunks_save_const_string (list, "");