vp8dec: Also destroy decoder in set_format() if it was created already

Fixes a memory leak.
This commit is contained in:
Sebastian Dröge 2012-11-12 10:08:57 +01:00
parent bd0ef7fec3
commit ef2cc91eb9

View file

@ -292,13 +292,16 @@ gst_vp8_dec_stop (GstVideoDecoder * base_video_decoder)
gst_video_codec_state_unref (gst_vp8_dec->output_state);
gst_vp8_dec->output_state = NULL;
}
if (gst_vp8_dec->input_state) {
gst_video_codec_state_unref (gst_vp8_dec->input_state);
gst_vp8_dec->input_state = NULL;
}
if (gst_vp8_dec->decoder_inited)
vpx_codec_destroy (&gst_vp8_dec->decoder);
gst_vp8_dec->decoder_inited = FALSE;
return TRUE;
}
@ -308,6 +311,9 @@ gst_vp8_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
GstVP8Dec *gst_vp8_dec = GST_VP8_DEC (decoder);
GST_DEBUG_OBJECT (gst_vp8_dec, "set_format");
if (decoder->decoder_inited)
vpx_codec_destroy (&decoder->decoder);
gst_vp8_dec->decoder_inited = FALSE;
if (gst_vp8_dec->input_state)