mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
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:
parent
53a9b430f3
commit
90c96fc17b
1 changed files with 7 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue