summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWind Yuan <feng.yuan@intel.com>2012-08-26 22:29:04 -0400
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:49:15 +0100
commit593d31087686abfb5766a7443ea6ab10ffc2bd8b (patch)
tree76292fa19616483224012818876fc998c65da9fb
parentc8cd9bd2ca75b6cca09afff4f48ad2bb532e7b69 (diff)
vaapidecode: flush buffers when receiving EOS.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
-rw-r--r--gst/vaapi/gstvaapidecode.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c
index d6bd0971..4d081357 100644
--- a/gst/vaapi/gstvaapidecode.c
+++ b/gst/vaapi/gstvaapidecode.c
@@ -407,6 +407,18 @@ gst_vaapidecode_reset(GstVaapiDecode *decode, GstCaps *caps)
return gst_vaapidecode_create(decode, caps);
}
+static gboolean
+gst_vaapidecode_flush(GstVaapiDecode *decode)
+{
+ g_return_val_if_fail(decode->decoder, FALSE);
+
+ if (!gst_vaapi_decoder_put_buffer(decode->decoder, NULL))
+ return FALSE;
+ if (gst_vaapidecode_step(decode) != GST_FLOW_OK)
+ return FALSE;
+ return TRUE;
+}
+
/* GstImplementsInterface interface */
static gboolean
@@ -680,6 +692,11 @@ gst_vaapidecode_sink_event(GstPad *pad, GstEvent *event)
return TRUE;
}
break;
+ case GST_EVENT_EOS:
+ if (!gst_vaapidecode_flush(decode)) {
+ GST_WARNING("failed to flush buffers");
+ }
+ break;
default:
break;
}