From fff2bcb1a05c79f4aabd93236d972153ded4c871 Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Sat, 6 Feb 2010 14:39:59 +0100 Subject: Fix leakage of vo_frame_t on reset/flush/dispose If a decoded_pic was locally cached, because it is the first half of a reference picture it would not get freed in case of a reset/flush/dispose. --- src/video_dec/libvdpau/vdpau_h264.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/video_dec/libvdpau/vdpau_h264.c b/src/video_dec/libvdpau/vdpau_h264.c index 28d455f39..18a117508 100644 --- a/src/video_dec/libvdpau/vdpau_h264.c +++ b/src/video_dec/libvdpau/vdpau_h264.c @@ -696,13 +696,21 @@ static void vdpau_h264_flush (video_decoder_t *this_gen) { vdpau_h264_decoder_t *this = (vdpau_h264_decoder_t*) this_gen; struct decoded_picture *decoded_pic = NULL; + if(this->dangling_img) + this->dangling_img->free(this->dangling_img); + this->last_img = this->dangling_img = NULL; + + if (this->last_ref_pic) { + release_decoded_picture(this->last_ref_pic); + this->last_ref_pic = NULL; + } + while ((decoded_pic = dpb_get_next_out_picture(&(this->nal_parser->dpb), 1)) != NULL) { decoded_pic->img->top_field_first = dp_top_field_first(decoded_pic); xprintf(this->xine, XINE_VERBOSITY_DEBUG, "h264 flush, draw pts: %lld\n", decoded_pic->img->pts); decoded_pic->img->draw(decoded_pic->img, this->stream); dpb_set_output_picture(&(this->nal_parser->dpb), decoded_pic); - this->last_img = NULL; } dpb_free_all(&this->nal_parser->dpb); this->reset = VO_NEW_SEQUENCE_FLAG; @@ -737,6 +745,11 @@ static void vdpau_h264_reset (video_decoder_t *this_gen) { this->wait_for_frame_start = this->have_frame_boundary_marks; } + if (this->last_ref_pic) { + release_decoded_picture(this->last_ref_pic); + this->last_ref_pic = NULL; + } + if (this->dangling_img) { this->dangling_img->free(this->dangling_img); this->dangling_img = NULL; @@ -764,6 +777,11 @@ static void vdpau_h264_dispose (video_decoder_t *this_gen) { vdpau_h264_decoder_t *this = (vdpau_h264_decoder_t *) this_gen; + if (this->last_ref_pic) { + release_decoded_picture(this->last_ref_pic); + this->last_ref_pic = NULL; + } + if (this->dangling_img) { this->dangling_img->free(this->dangling_img); this->dangling_img = NULL; -- cgit v1.2.3