From b2795b0844cfab5f5d73f93f90df417a037f73eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Tue, 30 Dec 2008 13:50:01 +0000 Subject: Memory management cleanup; fix freeze after decoder failure. --- src/libvdpau/dpb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/libvdpau/dpb.c') diff --git a/src/libvdpau/dpb.c b/src/libvdpau/dpb.c index 7ad87bab7..561b1efa7 100644 --- a/src/libvdpau/dpb.c +++ b/src/libvdpau/dpb.c @@ -31,18 +31,15 @@ struct decoded_picture* init_decoded_picture(struct nal_unit *src_nal, VdpVideoSurface surface, vo_frame_t *img) { - struct decoded_picture *pic = malloc(sizeof(struct decoded_picture)); + struct decoded_picture *pic = calloc(1, sizeof(struct decoded_picture)); pic->nal = init_nal_unit(); copy_nal_unit(pic->nal, src_nal); - pic->used_for_reference = 0; - pic->delayed_output = 0; pic->top_is_reference = pic->nal->slc->field_pic_flag ? (pic->nal->slc->bottom_field_flag ? 0 : 1) : 1; pic->bottom_is_reference = pic->nal->slc->field_pic_flag ? (pic->nal->slc->bottom_field_flag ? 1 : 0) : 1; pic->surface = surface; pic->img = img; - pic->next = NULL; return pic; } @@ -51,6 +48,7 @@ void free_decoded_picture(struct decoded_picture *pic) { pic->img->free(pic->img); free_nal_unit(pic->nal); + free(pic); } struct decoded_picture* dpb_get_next_out_picture(struct dpb *dpb) @@ -315,6 +313,7 @@ void dpb_free_all( struct dpb *dpb ) } while (pic != NULL); printf("dpb_free_all, used: %d\n", dpb->used); + dpb->pictures = NULL; } int fill_vdpau_reference_list(struct dpb *dpb, VdpReferenceFrameH264 *reflist) -- cgit v1.2.3