msdkdec: log an error if leaking surfaces in finalize
The for loop in gst_msdkdec_handle_frame is error prone about how it manages surfaces. Because sometimes it sets the surface variable to NULL and sometimes it needs to free it right away. So better to print an error if surfaces are leaked to help with any change around the loop.
This commit is contained in:
parent
2077061333
commit
2af672d00a
@ -1569,6 +1569,12 @@ gst_msdkdec_finalize (GObject * object)
|
||||
|
||||
g_array_unref (thiz->tasks);
|
||||
g_object_unref (thiz->adapter);
|
||||
|
||||
/* NULL is the empty list. */
|
||||
if (G_UNLIKELY (thiz->decoded_msdk_surfaces != NULL)) {
|
||||
GST_ERROR_OBJECT (thiz, "leaking %u surfaces",
|
||||
g_list_length (thiz->decoded_msdk_surfaces));
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -1658,4 +1664,8 @@ gst_msdkdec_init (GstMsdkDec * thiz)
|
||||
thiz->force_reset_on_res_change = TRUE;
|
||||
thiz->postpone_free_surface = FALSE;
|
||||
thiz->adapter = gst_adapter_new ();
|
||||
thiz->input_state = NULL;
|
||||
thiz->pool = NULL;
|
||||
thiz->context = NULL;
|
||||
thiz->decoded_msdk_surfaces = NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user