decoder: fix check for end-of-stream in raw API mode.

Make sure to immediately return GST_VAAPI_DECODER_STATUS_END_OF_STREAM
if the end-of-stream was already reached at the previous iteration.
This commit is contained in:
Gwenole Beauchesne 2013-01-15 17:21:50 +01:00
parent cc347cb41e
commit e4e3a58bc0
2 changed files with 9 additions and 5 deletions

View file

@ -264,9 +264,12 @@ decode_step(GstVaapiDecoder *decoder)
GstVaapiParserState * const ps = &priv->parser_state;
GstVaapiDecoderStatus status;
GstBuffer *buffer;
gboolean got_frame, at_eos = FALSE;
gboolean got_frame;
guint got_unit_size;
if (G_UNLIKELY(ps->at_eos))
return GST_VAAPI_DECODER_STATUS_END_OF_STREAM;
status = gst_vaapi_decoder_check_status(decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
return status;
@ -279,8 +282,8 @@ decode_step(GstVaapiDecoder *decoder)
if (!buffer)
return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
at_eos = GST_BUFFER_IS_EOS(buffer);
if (!at_eos)
ps->at_eos = GST_BUFFER_IS_EOS(buffer);
if (!ps->at_eos)
gst_adapter_push(ps->input_adapter, buffer);
do {
@ -293,7 +296,7 @@ decode_step(GstVaapiDecoder *decoder)
parse:
status = do_parse(decoder, ps->current_frame,
ps->input_adapter, at_eos, &got_unit_size, &got_frame);
ps->input_adapter, ps->at_eos, &got_unit_size, &got_frame);
GST_DEBUG("parse frame (status = %d)", status);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
break;

View file

@ -153,7 +153,8 @@ struct _GstVaapiParserState {
gint input_offset2;
GstAdapter *output_adapter;
GstVaapiDecoderUnit next_unit;
gboolean next_unit_pending;
guint next_unit_pending : 1;
guint at_eos : 1;
};
struct _GstVaapiDecoderPrivate {