camerabin2: don't leak element name strings

Don't leak string copy returned by gst_element_get_name(). Also, check
for certain elements by checking the plugin feature / factory name, not
the assigned object name.
This commit is contained in:
Tim-Philipp Müller 2011-03-11 10:34:23 +00:00
parent 53a9b430f3
commit 90c96fc17b

View file

@ -682,9 +682,13 @@ static void
encodebin_element_added (GstElement * encodebin, GstElement * new_element,
GstCameraBin * camera)
{
if (g_str_has_prefix (gst_element_get_name (new_element), "audiorate") ||
g_str_has_prefix (gst_element_get_name (new_element), "videorate")) {
g_object_set (new_element, "skip-to-first", TRUE, NULL);
GstElementFactory *factory = gst_element_get_factory (new_element);
if (factory != NULL) {
if (strcmp (GST_PLUGIN_FEATURE_NAME (factory), "audiorate") == 0 ||
strcmp (GST_PLUGIN_FEATURE_NAME (factory), "videorate") == 0) {
g_object_set (new_element, "skip-to-first", TRUE, NULL);
}
}
}