From 03e85bbc0f0bd19b9c6ccd711d299a9c33afbe67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Sun, 10 Jul 2016 13:46:25 +0200 Subject: [PATCH] vaapidecode: call purge at flush() Calling flush() vmethod means "to flush all remaining data from the decoder without pushing it downstream". Nonetheless flush() is calling gst_vaapidecode_internal_flush(), which calls gst_video_decoder_have_frame() if there is still something in the input adapter, which may push buffers to downstream by calling handle_frame(). This patch changes this behavior by calling gst_vaapidecode_purge() rather than gst_vaapidecode_internal_flush(), which does what we want: flushes the VA decoder and releases all the rest of decoded frames. https://bugzilla.gnome.org/show_bug.cgi?id=768652 --- gst/vaapi/gstvaapidecode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 2cc8c47879..2d3a558ddf 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -1001,9 +1001,13 @@ gst_vaapidecode_flush (GstVideoDecoder * vdec) { GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec); - if (decode->decoder && !gst_vaapidecode_internal_flush (vdec)) + if (!decode->decoder) return FALSE; + GST_LOG_OBJECT (vdec, "flushing"); + + gst_vaapidecode_purge (decode); + /* There could be issues if we avoid the reset_full() while doing * seeking: we have to reset the internal state */ return gst_vaapidecode_reset_full (decode, decode->sinkpad_caps, TRUE);