Commit 01588491 authored by He Junyan's avatar He Junyan
Browse files

va: Fix some gst_object_unref error because the pointer is NULL.

!1957 introduces some error of gst_object_unref for NULL pointer.
Fixes all of them.

Part-of: <gstreamer/gst-plugins-bad!1959>
parent 82c0f901
......@@ -51,7 +51,7 @@ gst_va_base_dec_open (GstVideoDecoder * decoder)
gst_object_replace ((GstObject **) (&base->decoder),
(GstObject *) va_decoder);
gst_object_unref (va_decoder);
gst_clear_object (&va_decoder);
} else {
ret = TRUE;
}
......@@ -98,10 +98,10 @@ gst_va_base_dec_getcaps (GstVideoDecoder * decoder, GstCaps * filter)
gst_object_replace ((GstObject **) & va_decoder, (GstObject *) base->decoder);
if (va_decoder)
if (va_decoder) {
caps = gst_va_decoder_get_sinkpad_caps (va_decoder);
gst_object_unref (va_decoder);
}
if (caps) {
if (filter) {
......@@ -133,7 +133,7 @@ gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
ret = gst_va_handle_context_query (GST_ELEMENT_CAST (decoder), query,
display);
gst_object_unref (display);
gst_clear_object (&display);
break;
}
case GST_QUERY_CAPS:{
......@@ -151,7 +151,7 @@ gst_va_base_dec_src_query (GstVideoDecoder * decoder, GstQuery * query)
if (!fixed_caps && va_decoder)
caps = gst_va_decoder_get_srcpad_caps (va_decoder);
gst_object_unref (va_decoder);
gst_clear_object (&va_decoder);
if (caps) {
if (filter) {
......@@ -191,7 +191,8 @@ gst_va_base_dec_sink_query (GstVideoDecoder * decoder, GstQuery * query)
ret = gst_va_handle_context_query (GST_ELEMENT_CAST (decoder), query,
display);
gst_object_unref (display);
gst_clear_object (&display);
return ret;
}
......
......@@ -199,12 +199,13 @@ gst_va_ensure_element_data (gpointer element, const gchar * render_device_path,
display = gst_va_display_drm_new_from_path (render_device_path);
gst_object_replace ((GstObject **) display_ptr, (GstObject *) display);
gst_object_unref (display);
gst_va_element_propagate_display_context (element, display);
gst_clear_object (&display);
done:
return *display_ptr != NULL;
return g_atomic_pointer_get (display_ptr) != NULL;
}
gboolean
......
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