mpeg2: don't decode anything before the first sequence_header().

Skip all pictures prior to the first sequence_header(). Besides,
skip all picture_data() if there was no prior picture_header().

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Wind Yuan 2012-03-13 02:03:31 -04:00 committed by Gwenole Beauchesne
parent 2ebfa66ade
commit fc3edde05c

View file

@ -798,6 +798,8 @@ decode_buffer(GstVaapiDecoderMpeg2 *decoder, GstBuffer *buffer)
type = start_code & 0xff;
switch (type) {
case GST_MPEG_VIDEO_PACKET_PICTURE:
if (!priv->width || !priv->height)
break;
status = decode_picture(decoder, buf, buf_size);
break;
case GST_MPEG_VIDEO_PACKET_SEQUENCE:
@ -813,6 +815,8 @@ decode_buffer(GstVaapiDecoderMpeg2 *decoder, GstBuffer *buffer)
status = decode_quant_matrix_ext(decoder, buf, buf_size);
break;
case GST_MPEG_VIDEO_PACKET_EXT_PICTURE:
if (!priv->width || !priv->height)
break;
status = decode_picture_ext(decoder, buf, buf_size);
break;
default:
@ -835,6 +839,8 @@ decode_buffer(GstVaapiDecoderMpeg2 *decoder, GstBuffer *buffer)
default:
if (type >= GST_MPEG_VIDEO_PACKET_SLICE_MIN &&
type <= GST_MPEG_VIDEO_PACKET_SLICE_MAX) {
if (!priv->current_picture)
break;
status = decode_slice(
decoder,
type - GST_MPEG_VIDEO_PACKET_SLICE_MIN,