diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index c7f3abb7c3..1066289467 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -987,8 +987,7 @@ gst_vaapi_decoder_h265_destroy (GstVaapiDecoder * base_decoder) guint i; gst_vaapi_decoder_h265_close (decoder); - g_free (priv->dpb); - priv->dpb = NULL; + g_clear_pointer (&priv->dpb, g_free); priv->dpb_count = priv->dpb_size_max = priv->dpb_size = 0; for (i = 0; i < G_N_ELEMENTS (priv->pps); i++) @@ -1018,6 +1017,13 @@ gst_vaapi_decoder_h265_create (GstVaapiDecoder * base_decoder) return TRUE; } +static GstVaapiDecoderStatus +gst_vaapi_decoder_h265_reset (GstVaapiDecoder * base_decoder) +{ + gst_vaapi_decoder_h265_destroy (base_decoder); + gst_vaapi_decoder_h265_create (base_decoder); + return GST_VAAPI_DECODER_STATUS_SUCCESS; +} static void fill_profiles (GstVaapiProfile profiles[16], guint * n_profiles_ptr, @@ -3052,8 +3058,7 @@ gst_vaapi_decoder_h265_class_init (GstVaapiDecoderH265Class * klass) object_class->finalize = gst_vaapi_decoder_h265_finalize; - decoder_class->create = gst_vaapi_decoder_h265_create; - decoder_class->destroy = gst_vaapi_decoder_h265_destroy; + decoder_class->reset = gst_vaapi_decoder_h265_reset; decoder_class->parse = gst_vaapi_decoder_h265_parse; decoder_class->decode = gst_vaapi_decoder_h265_decode; decoder_class->start_frame = gst_vaapi_decoder_h265_start_frame;