From 3a8d50a355311f8f5dc286b7cc8da770e12986aa Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Wed, 31 Jan 2018 07:34:32 +0000 Subject: [PATCH] aom: Implement flush for av1dec https://bugzilla.gnome.org/show_bug.cgi?id=791674 --- ext/aom/gstav1dec.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ext/aom/gstav1dec.c b/ext/aom/gstav1dec.c index b2a9b51ad3..d33118e641 100644 --- a/ext/aom/gstav1dec.c +++ b/ext/aom/gstav1dec.c @@ -70,6 +70,7 @@ static gboolean gst_av1_dec_start (GstVideoDecoder * dec); static gboolean gst_av1_dec_stop (GstVideoDecoder * dec); static gboolean gst_av1_dec_set_format (GstVideoDecoder * dec, GstVideoCodecState * state); +static gboolean gst_av1_dec_flush (GstVideoDecoder * dec); static GstFlowReturn gst_av1_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame); @@ -109,6 +110,8 @@ gst_av1_dec_class_init (GstAV1DecClass * klass) vdec_class->start = GST_DEBUG_FUNCPTR (gst_av1_dec_start); vdec_class->stop = GST_DEBUG_FUNCPTR (gst_av1_dec_stop); + vdec_class->flush = GST_DEBUG_FUNCPTR (gst_av1_dec_flush); + vdec_class->set_format = GST_DEBUG_FUNCPTR (gst_av1_dec_set_format); vdec_class->handle_frame = GST_DEBUG_FUNCPTR (gst_av1_dec_handle_frame); @@ -209,6 +212,24 @@ gst_av1_dec_set_format (GstVideoDecoder * dec, GstVideoCodecState * state) return TRUE; } +static gboolean +gst_av1_dec_flush (GstVideoDecoder * dec) +{ + GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec); + + if (av1dec->output_state) { + gst_video_codec_state_unref (av1dec->output_state); + av1dec->output_state = NULL; + } + + if (av1dec->decoder_inited) { + aom_codec_destroy (&av1dec->decoder); + } + av1dec->decoder_inited = FALSE; + + return TRUE; +} + static GstFlowReturn gst_av1_dec_open_codec (GstAV1Dec * av1dec, GstVideoCodecFrame * frame) {