Ticket #372: mplayer-mpegpes-resolution-change-fix-1.0pre7try2-1.patch

File mplayer-mpegpes-resolution-change-fix-1.0pre7try2-1.patch, 1.0 KB (added by bugs@…, 21 years ago)

Fix along with a comment describing a slightly more optimal solution.

  • libmpcodecs/vf.c

    diff -ru MPlayer-1.0pre7try2-orig/libmpcodecs/vf.c MPlayer-1.0pre7try2/libmpcodecs/vf.c
    old new  
    302302    if(mpi->width!=w2 || mpi->height!=h){
    303303//      printf("vf.c: MPI parameters changed!  %dx%d -> %dx%d   \n", mpi->width,mpi->height,w2,h);
    304304        if(mpi->flags&MP_IMGFLAG_ALLOCATED){
    305             if(mpi->width<w2 || mpi->height<h){
     305            /* Commented out if() below in order to ALWAYS reallocate
     306             * buffer memory regrdless if resolution increases or
     307             * decreases. A slightly better solution would be to just
     308             * to recalculate offsets when the resolution decreases,
     309             * but the only benefit would be saving one free and one
     310             * memalign call. */
     311
     312            /* if(mpi->width<w2 || mpi->height<h) */ {
    306313                // need to re-allocate buffer memory:
    307314                free(mpi->planes[0]);
    308315                mpi->flags&=~MP_IMGFLAG_ALLOCATED;