mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1959>
This commit is contained in:
parent
82c0f90197
commit
0158849145
2 changed files with 11 additions and 9 deletions
|
@ -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);
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue