Commit e4e3a58b authored by Gwenole Beauchesne's avatar Gwenole Beauchesne

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.
parent cc347cb4
......@@ -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;
......
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment