From 94f5f4e602f9cc4eea67e6dc8fc4ab956a958015 Mon Sep 17 00:00:00 2001 From: Wind Yuan Date: Sun, 26 Aug 2012 22:29:04 -0400 Subject: [PATCH 1/4] decode: flush buffers when receiving EOS --- gst/vaapi/gstvaapidecode.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 253874c..1a94594 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -388,6 +388,23 @@ gst_vaapidecode_reset(GstVaapiDecode *decode, GstCaps *caps) return gst_vaapidecode_create(decode, caps); } +static gboolean +gst_vaapidecode_flush(GstVaapiDecode *decode) +{ + GstVaapiDecoder *decoder; + GstVaapiSurfaceProxy *surface; + GstVaapiDecoderStatus status; + gboolean ret; + + g_return_val_if_fail(decode->decoder, FALSE); + + if (!gst_vaapi_decoder_put_buffer(decode->decoder, NULL)) + return FALSE; + + gst_vaapidecode_step(decode); + return TRUE; +} + /* GstImplementsInterface interface */ static gboolean @@ -661,6 +678,11 @@ gst_vaapidecode_sink_event(GstPad *pad, GstEvent *event) return TRUE; } break; + case GST_EVENT_EOS: + if (!gst_vaapidecode_flush(decode)) { + GST_DEBUG("flush buffers failed"); + } + break; default: break; } -- 1.7.6.5