From 035ee739dec2e302cd02f0b88a1a9aa74b43aca4 Mon Sep 17 00:00:00 2001 From: Zhao Halley Date: Wed, 9 Jan 2013 13:40:46 +0800 Subject: [PATCH] reset got_sps/got_pps when there are corrupted sps/pps header. this can stop (incorrect) slice parsing and frame decoding, fix https://bugs.freedesktop.org/show_bug.cgi?id=57902 --- ext/codecparsers | 2 +- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) mode change 100644 => 100755 gst-libs/gst/vaapi/gstvaapidecoder_h264.c diff --git a/ext/codecparsers b/ext/codecparsers index 73d6aab..02ce727 160000 --- a/ext/codecparsers +++ b/ext/codecparsers @@ -1 +1 @@ -Subproject commit 73d6aab46c14d943f2a0238e70812d775f06ffee +Subproject commit 02ce7271358b4368e6197255c4085fdc69124b4c 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