[Libva] [PATCH] gst-vaapi-0.4-branch: reset got_sps/got_pps when there are corrupted sps/pps header.

Zhao Halley halley.zhao at intel.com
Tue Jan 8 23:30:55 PST 2013


this can skip (incorrect) slice parsing and frame decoding until next valid header,
fix https://bugs.freedesktop.org/show_bug.cgi?id=57902
---
 gst-libs/gst/vaapi/gstvaapidecoder_h264.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 gst-libs/gst/vaapi/gstvaapidecoder_h264.c

diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
old mode 100644
new mode 100755
index 3f8bb84..80839b0
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -1175,8 +1175,10 @@ decode_sps(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
 
     memset(sps, 0, sizeof(*sps));
     result = gst_h264_parser_parse_sps(priv->parser, nalu, sps, TRUE);
-    if (result != GST_H264_PARSER_OK)
+    if (result != GST_H264_PARSER_OK) {
+	    priv->got_sps = FALSE;
         return get_status(result);
+    }
 
     priv->got_sps = TRUE;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;
@@ -1193,8 +1195,10 @@ decode_pps(GstVaapiDecoderH264 *decoder, GstH264NalUnit *nalu)
 
     memset(pps, 0, sizeof(*pps));
     result = gst_h264_parser_parse_pps(priv->parser, nalu, pps);
-    if (result != GST_H264_PARSER_OK)
+    if (result != GST_H264_PARSER_OK) {
+        priv->got_pps = FALSE;
         return get_status(result);
+    }
 
     priv->got_pps = TRUE;
     return GST_VAAPI_DECODER_STATUS_SUCCESS;
@@ -3244,6 +3248,8 @@ gst_vaapi_decoder_h264_init(GstVaapiDecoderH264 *decoder)
     priv->is_avc                = FALSE;
     priv->has_context           = FALSE;
     priv->progressive_sequence  = TRUE;
+    priv->got_sps               = FALSE;
+    priv->got_pps               = FALSE;
 
     memset(priv->dpb, 0, sizeof(priv->dpb));
     memset(priv->short_ref, 0, sizeof(priv->short_ref));
-- 
1.7.9.5



More information about the Libva mailing list