# HG changeset patch # User reimar # Date 1338412085 0 # Node ID 8e539c65122723196f270acfe55501fe285b99c3 # Parent 99ccfbcaa0fa7d3deebf783ab9c404a26552347e Add/improve some code to help debugging DR in filters. diff -r 99ccfbcaa0fa -r 8e539c651227 libmpcodecs/vf.c --- a/libmpcodecs/vf.c Wed May 30 21:05:21 2012 +0000 +++ b/libmpcodecs/vf.c Wed May 30 21:08:05 2012 +0000 @@ -361,7 +361,8 @@ if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) av_freep(&mpi->planes[1]); mpi->flags&=~MP_IMGFLAG_ALLOCATED; - mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n"); + mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory in vf_%s :(\n", + vf->info->name); } // } else { } { @@ -428,6 +429,10 @@ mpi->qscale = NULL; } mpi->usage_count++; + // TODO: figure out what is going on with EXPORT types + if (mpi->usage_count > 1 && mpi->type != MP_IMGTYPE_EXPORT) + mp_msg(MSGT_VFILTER, MSGL_V, "Suspicious mp_image usage count %i in vf_%s (type %i)\n", + mpi->usage_count, vf->info->name, mpi->type); // printf("\rVF_MPI: %p %p %p %d %d %d \n", // mpi->planes[0],mpi->planes[1],mpi->planes[2], // mpi->stride[0],mpi->stride[1],mpi->stride[2]); @@ -693,6 +698,11 @@ int vf_next_put_image(struct vf_instance *vf,mp_image_t *mpi, double pts){ mpi->usage_count--; + if (mpi->usage_count < 0) { + mp_msg(MSGT_VFILTER, MSGL_V, "Bad mp_image usage count %i in vf_%s (type %i)\n", + mpi->usage_count, vf->info->name, mpi->type); + mpi->usage_count = 0; + } return vf->next->put_image(vf->next,mpi, pts); }