Commit 8ae80637 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Release sink caps in the error path.

parent a4ef56e1
......@@ -338,7 +338,7 @@ NTSTATUS wg_transform_create(void *args)
struct wg_format output_format = *params->output_format;
struct wg_format input_format = *params->input_format;
GstElement *first = NULL, *last = NULL, *element;
GstCaps *raw_caps = NULL, *src_caps = NULL;
GstCaps *sink_caps = NULL, *src_caps = NULL;
NTSTATUS status = STATUS_UNSUCCESSFUL;
GstPadTemplate *template = NULL;
struct wg_transform *transform;
......@@ -395,7 +395,7 @@ NTSTATUS wg_transform_create(void *args)
* raw output media type should be enough.
*/
media_type = gst_structure_get_name(gst_caps_get_structure(transform->output_caps, 0));
if (!(raw_caps = gst_caps_new_empty_simple(media_type)))
if (!(sink_caps = gst_caps_new_empty_simple(media_type)))
goto out;
switch (input_format.major_type)
......@@ -408,12 +408,9 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_VIDEO_INDEO:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_MPEG1:
if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps))
if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, sink_caps))
|| !append_element(transform->container, element, &first, &last))
{
gst_caps_unref(raw_caps);
goto out;
}
break;
case WG_MAJOR_TYPE_AUDIO:
......@@ -421,12 +418,9 @@ NTSTATUS wg_transform_create(void *args)
break;
case WG_MAJOR_TYPE_UNKNOWN:
GST_FIXME("Format %u not implemented!", input_format.major_type);
gst_caps_unref(raw_caps);
goto out;
}
gst_caps_unref(raw_caps);
switch (output_format.major_type)
{
case WG_MAJOR_TYPE_AUDIO:
......@@ -507,6 +501,7 @@ NTSTATUS wg_transform_create(void *args)
goto out;
gst_caps_unref(src_caps);
gst_caps_unref(sink_caps);
GST_INFO("Created winegstreamer transform %p.", transform);
params->transform = (wg_transform_t)(ULONG_PTR)transform;
......@@ -521,6 +516,8 @@ out:
gst_object_unref(transform->my_src);
if (src_caps)
gst_caps_unref(src_caps);
if (sink_caps)
gst_caps_unref(sink_caps);
if (transform->allocator)
wg_allocator_destroy(transform->allocator);
if (transform->drain_query)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment