From b33dd6930081c7ab8d0f1ceee48bc89b21105cdd Mon Sep 17 00:00:00 2001 From: Wind Yuan Date: Fri, 30 Mar 2012 03:04:40 -0400 Subject: [PATCH] mpeg4: improve error checking while decoding packets. decode_picture() could return an error when an MPEG-4 profile is not supported for example. In this case, the underlying VA context is not allocated and no other proper action can be taken. Likewise on exit from decode_slice(). Signed-off-by: Gwenole Beauchesne --- gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c index 8f6af34..ca31ebd 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c @@ -753,6 +753,8 @@ decode_packet(GstVaapiDecoderMpeg4 *decoder, GstMpeg4Packet packet) } else if (tos->type == GST_MPEG4_VIDEO_OBJ_PLANE) { status = decode_picture(decoder, packet.data + packet.offset, packet.size); + if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) + return status; /* decode slice * A resync marker shall only be located immediately before a macroblock @@ -769,6 +771,8 @@ decode_packet(GstVaapiDecoderMpeg4 *decoder, GstMpeg4Packet packet) if (priv->vol_hdr.resync_marker_disable) { status = decode_slice(decoder, _data, _data_size, FALSE); + if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) + return status; } else { // next start_code is required to determine the end of last slice -- 2.7.4