From 96437a7a1691067a5e7975f548623bc6a6b8e799 Mon Sep 17 00:00:00 2001 From: Wind Yuan Date: Fri, 27 Apr 2012 04:10:17 -0400 Subject: [PATCH] mpeg4: handle skipped frames (vop_hdr->coded = 0). Gracefully skip non VOP coded frames. Signed-off-by: Gwenole Beauchesne --- gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c index 15ec95a70c..9f07a8a617 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c @@ -496,6 +496,9 @@ decode_picture(GstVaapiDecoderMpeg4 *decoder, const guint8 *buf, guint buf_size) } else { parser_result = gst_mpeg4_parse_video_object_plane(vop_hdr, sprite_trajectory, vol_hdr, buf, buf_size); + /* Need to skip this frame if VOP was not coded */ + if (GST_MPEG4_PARSER_OK == parser_result && !vop_hdr->coded) + return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA; } if (parser_result != GST_MPEG4_PARSER_OK) { @@ -964,7 +967,8 @@ decode_buffer(GstVaapiDecoderMpeg4 *decoder, GstBuffer *buffer) break; } status = decode_packet(decoder, packet); - if (GST_VAAPI_DECODER_STATUS_SUCCESS == status) { + if (GST_VAAPI_DECODER_STATUS_SUCCESS == status || + GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA == status) { consumed_size = packet.offset + packet.size - pos; pos = packet.offset + packet.size; if (gst_adapter_available(priv->adapter) >= pos)