vaapidecode: flush buffers when receiving EOS.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Wind Yuan 2012-08-26 22:29:04 -04:00 committed by Gwenole Beauchesne
parent 84f308010f
commit da1e4e3918

View file

@ -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;
}