mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
vaapidecode: Tell the base class about released frames on close
The base class needs to be informed about frames that were still queued in the decoder on release, otherwise they are leaked. https://bugzilla.gnome.org/show_bug.cgi?id=747999
This commit is contained in:
parent
dedbbdd41b
commit
11c963a3c1
2 changed files with 16 additions and 19 deletions
|
@ -774,6 +774,7 @@ decode_sequence_end(GstVaapiDecoderMpeg2 *decoder)
|
|||
{
|
||||
GstVaapiDecoderMpeg2Private * const priv = &decoder->priv;
|
||||
|
||||
if (priv->dpb)
|
||||
gst_vaapi_dpb_flush(priv->dpb);
|
||||
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -633,6 +633,19 @@ gst_vaapidecode_create (GstVaapiDecode * decode, GstCaps * caps)
|
|||
static void
|
||||
gst_vaapidecode_destroy (GstVaapiDecode * decode)
|
||||
{
|
||||
GstVideoCodecFrame *out_frame = NULL;
|
||||
|
||||
if (decode->decoder) {
|
||||
gst_vaapi_decoder_flush (decode->decoder);
|
||||
|
||||
/* Purge all decoded frames as we don't need them (e.g. seek) */
|
||||
while (gst_vaapi_decoder_get_frame_with_timeout (decode->decoder,
|
||||
&out_frame, 0) == GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
||||
gst_video_decoder_release_frame (GST_VIDEO_DECODER (decode), out_frame);
|
||||
gst_video_codec_frame_unref (out_frame);
|
||||
out_frame = NULL;
|
||||
}
|
||||
}
|
||||
gst_vaapi_decoder_replace (&decode->decoder, NULL);
|
||||
gst_caps_replace (&decode->decoder_caps, NULL);
|
||||
|
||||
|
@ -652,24 +665,7 @@ gst_vaapidecode_reset_full (GstVaapiDecode * decode, GstCaps * caps,
|
|||
/* Reset tracked frame size */
|
||||
decode->current_frame_size = 0;
|
||||
|
||||
/* Reset timers if hard reset was requested (e.g. seek) */
|
||||
if (hard) {
|
||||
GstVideoDecoder *const vdec = GST_VIDEO_DECODER (decode);
|
||||
GstVideoCodecFrame *out_frame = NULL;
|
||||
|
||||
gst_vaapi_decoder_flush (decode->decoder);
|
||||
|
||||
/* Purge all decoded frames as we don't need them (e.g. seek) */
|
||||
while (gst_vaapi_decoder_get_frame_with_timeout (decode->decoder,
|
||||
&out_frame, 0) == GST_VAAPI_DECODER_STATUS_SUCCESS) {
|
||||
gst_video_decoder_drop_frame (vdec, out_frame);
|
||||
gst_video_codec_frame_unref (out_frame);
|
||||
out_frame = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Only reset decoder if codec type changed */
|
||||
else if (decode->decoder && decode->decoder_caps) {
|
||||
if (!hard && decode->decoder && decode->decoder_caps) {
|
||||
if (gst_caps_is_always_compatible (caps, decode->decoder_caps))
|
||||
return TRUE;
|
||||
codec = gst_vaapi_codec_from_caps (caps);
|
||||
|
|
Loading…
Reference in a new issue