#include "sysdeps.h"
#include <string.h>
+#include <stdlib.h>
#include <gst/base/gstadapter.h>
#include <gst/codecparsers/gsth264parser.h>
#include "gstvaapidecoder_h264.h"
}
static void
-gst_vaapi_decoder_h264_close(GstVaapiDecoderH264 *decoder)
+gst_vaapi_decoder_h264_clear_buffer(GstVaapiDecoder *base)
{
+ GstVaapiDecoderH264 * const decoder = GST_VAAPI_DECODER_H264(base);
GstVaapiDecoderH264Private * const priv = decoder->priv;
gst_vaapi_picture_replace(&priv->current_picture, NULL);
dpb_clear(decoder);
+ if (priv->adapter) {
+ gst_adapter_clear(priv->adapter);
+ }
+}
+
+static void
+gst_vaapi_decoder_h264_close(GstVaapiDecoderH264 *decoder)
+{
+ GstVaapiDecoderH264Private * const priv = decoder->priv;
+
+ gst_vaapi_decoder_h264_clear_buffer(GST_VAAPI_DECODER_CAST(decoder));
+
if (priv->parser) {
gst_h264_nal_parser_free(priv->parser);
priv->parser = NULL;
}
if (priv->adapter) {
- gst_adapter_clear(priv->adapter);
g_object_unref(priv->adapter);
priv->adapter = NULL;
}
object_class->constructed = gst_vaapi_decoder_h264_constructed;
decoder_class->decode = gst_vaapi_decoder_h264_decode;
+ decoder_class->clear_buffer = gst_vaapi_decoder_h264_clear_buffer;
}
static void