mpeg4: handle skipped frames (vop_hdr->coded = 0).

Gracefully skip non VOP coded frames.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Wind Yuan 2012-04-27 04:10:17 -04:00 committed by Gwenole Beauchesne
parent 1632b40982
commit 96437a7a16

View file

@ -496,6 +496,9 @@ decode_picture(GstVaapiDecoderMpeg4 *decoder, const guint8 *buf, guint buf_size)
} }
else { else {
parser_result = gst_mpeg4_parse_video_object_plane(vop_hdr, sprite_trajectory, vol_hdr, buf, buf_size); 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) { if (parser_result != GST_MPEG4_PARSER_OK) {
@ -964,7 +967,8 @@ decode_buffer(GstVaapiDecoderMpeg4 *decoder, GstBuffer *buffer)
break; break;
} }
status = decode_packet(decoder, packet); 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; consumed_size = packet.offset + packet.size - pos;
pos = packet.offset + packet.size; pos = packet.offset + packet.size;
if (gst_adapter_available(priv->adapter) >= pos) if (gst_adapter_available(priv->adapter) >= pos)