mpeg4: improve error checking while decoding packets.
authorWind Yuan <feng.yuan@intel.com>
Fri, 30 Mar 2012 07:04:40 +0000 (03:04 -0400)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 30 Mar 2012 15:23:38 +0000 (17:23 +0200)
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 <gwenole.beauchesne@intel.com>
gst-libs/gst/vaapi/gstvaapidecoder_mpeg4.c

index 8f6af34..ca31ebd 100644 (file)
@@ -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