mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
mpeg2: Avoid crashes and warnings on re-opened decoder after a seek
Reset state and add some checks for safe state to avoid a crash and a warning after the decoder is destroyed/recreated during a seek.
This commit is contained in:
parent
c393b7e2ab
commit
f1a60ec6a2
1 changed files with 7 additions and 1 deletions
|
@ -308,6 +308,8 @@ gst_vaapi_decoder_mpeg2_close(GstVaapiDecoderMpeg2 *decoder)
|
|||
gst_vaapi_parser_info_mpeg2_replace(&priv->quant_matrix, NULL);
|
||||
gst_vaapi_parser_info_mpeg2_replace(&priv->slice_hdr, NULL);
|
||||
|
||||
priv->state = 0;
|
||||
|
||||
gst_vaapi_dpb_replace(&priv->dpb, NULL);
|
||||
}
|
||||
|
||||
|
@ -1104,6 +1106,9 @@ parse_slice(GstVaapiDecoderMpeg2 *decoder,
|
|||
GST_MPEG_VIDEO_STATE_GOT_PIC_HDR|
|
||||
GST_MPEG_VIDEO_STATE_GOT_PIC_EXT);
|
||||
|
||||
if (!is_valid_state(decoder, GST_MPEG_VIDEO_STATE_VALID_PIC_HEADERS))
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
|
||||
if (!gst_vaapi_parser_info_mpeg2_ensure(&priv->slice_hdr)) {
|
||||
GST_ERROR("failed to allocate parser info for slice header");
|
||||
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||
|
@ -1538,7 +1543,8 @@ gst_vaapi_decoder_mpeg2_flush(GstVaapiDecoder *base_decoder)
|
|||
GST_VAAPI_DECODER_MPEG2_CAST(base_decoder);
|
||||
GstVaapiDecoderMpeg2Private * const priv = &decoder->priv;
|
||||
|
||||
gst_vaapi_dpb_flush(priv->dpb);
|
||||
if (priv->dpb)
|
||||
gst_vaapi_dpb_flush(priv->dpb);
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue