mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-29 18:48:44 +00:00
camerabin: don't leak messages and element refs in preview
This commit is contained in:
parent
024b44b090
commit
4ab9f800a8
1 changed files with 14 additions and 1 deletions
|
@ -183,7 +183,7 @@ gst_camerabin_preview_convert (GstCameraBin * camera, GstBuffer * buf)
|
||||||
|
|
||||||
if (!src || !sink) {
|
if (!src || !sink) {
|
||||||
GST_WARNING ("pipeline doesn't have src / sink elements");
|
GST_WARNING ("pipeline doesn't have src / sink elements");
|
||||||
goto no_pipeline;
|
goto missing_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set (src, "size", (gint64) GST_BUFFER_SIZE (buf),
|
g_object_set (src, "size", (gint64) GST_BUFFER_SIZE (buf),
|
||||||
|
@ -234,6 +234,7 @@ gst_camerabin_preview_convert (GstCameraBin * camera, GstBuffer * buf)
|
||||||
g_return_val_if_reached (NULL);
|
g_return_val_if_reached (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gst_message_unref (msg);
|
||||||
} else {
|
} else {
|
||||||
g_warning ("Could not make preview image: %s", "timeout during conversion");
|
g_warning ("Could not make preview image: %s", "timeout during conversion");
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
@ -245,9 +246,21 @@ gst_camerabin_preview_convert (GstCameraBin * camera, GstBuffer * buf)
|
||||||
|
|
||||||
GST_BUFFER_FLAGS (buf) = bflags;
|
GST_BUFFER_FLAGS (buf) = bflags;
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (src)
|
||||||
|
gst_object_unref (src);
|
||||||
|
if (sink)
|
||||||
|
gst_object_unref (sink);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
missing_elements:
|
||||||
|
{
|
||||||
|
g_warning ("Could not make preview image: %s",
|
||||||
|
"missing elements in pipeline (unknown error)");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
no_pipeline:
|
no_pipeline:
|
||||||
{
|
{
|
||||||
g_warning ("Could not make preview image: %s",
|
g_warning ("Could not make preview image: %s",
|
||||||
|
|
Loading…
Reference in a new issue