From d2511a77258f72b221fcb8f9c41b085e454a88ce Mon Sep 17 00:00:00 2001 From: zhongcong Date: Thu, 14 Mar 2013 17:31:00 +0800 Subject: [PATCH] mpeg2: fix set quant_table to driver error --- gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c index de750fa..ee0f2c0 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c @@ -549,6 +549,7 @@ decode_sequence(GstVaapiDecoderMpeg2 *decoder, guchar *buf, guint buf_size) priv->width = seq_hdr->width; priv->height = seq_hdr->height; priv->has_seq_ext = FALSE; + priv->has_quant_matrix_ext = FALSE; priv->size_changed = TRUE; priv->quant_matrix_changed = TRUE; priv->progressive_sequence = TRUE; @@ -708,12 +709,6 @@ decode_picture(GstVaapiDecoderMpeg2 *decoder, guchar *buf, guint buf_size) gst_vaapi_picture_replace(&priv->current_picture, picture); gst_vaapi_picture_unref(picture); - status = ensure_quant_matrix(decoder, picture); - if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) { - GST_ERROR("failed to reset quantizer matrix"); - return status; - } - if (!gst_mpeg_video_parse_picture_header(pic_hdr, buf, buf_size, 4)) { GST_ERROR("failed to parse picture header"); return GST_VAAPI_DECODER_STATUS_ERROR_BITSTREAM_PARSER; @@ -910,9 +905,18 @@ decode_slice( guint8 quantiser_scale_code; guint8 intra_slice = 0; guint8 extra_bit_slice, junk8; + GstVaapiDecoderStatus status; GST_DEBUG("slice %d @ %p, %u bytes)", slice_no, buf, buf_size); + if (slice_no == 0){ + status = ensure_quant_matrix(decoder, picture); + if (status != GST_VAAPI_DECODER_STATUS_SUCCESS) { + GST_ERROR("failed to reset quantizer matrix"); + return status; + } + } + if (picture->slices->len == 0 && !fill_picture(decoder, picture)) return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; -- 2.7.4