[vlc-devel] commit: Used filter_New/DeletePicture when applicable. (Laurent Aimar )

Hugo Beauzee-Luyssen beauze.h at gmail.com
Thu May 28 16:39:51 CEST 2009


On Sat, May 16, 2009 at 10:21 PM, git version control <git at videolan.org> wrote:
> vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat May 16 22:20:52 2009 +0200| [d1d3d7b413a9a7cba2cec8c703f4cc3b045858ff] | committer: Laurent Aimar
>
> Used filter_New/DeletePicture when applicable.
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d1d3d7b413a9a7cba2cec8c703f4cc3b045858ff
> ---
>
>  modules/codec/invmem.c               |    1 -
>  modules/video_filter/adjust.c        |    2 +-
>  modules/video_filter/canvas.c        |    5 ++---
>  modules/video_filter/chain.c         |    4 ++--
>  modules/video_filter/swscale_maemo.c |    2 +-
>  5 files changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/modules/codec/invmem.c b/modules/codec/invmem.c
> index 4a6ed8f..2990644 100644
> --- a/modules/codec/invmem.c
> +++ b/modules/codec/invmem.c
> @@ -189,7 +189,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
>     if( p_sys->p_pic != NULL )
>         picture_Release( p_sys->p_pic );
>     p_sys->p_pic = decoder_NewPicture( p_dec );
> -    p_sys->p_pic = p_dec->pf_vout_buffer_new( p_dec );
>     p_sys->p_pic->b_force = true;
>     p_sys->p_pic->p->i_pitch = p_dec->p_sys->i_pitch;
>     p_sys->p_pic->date = p_block->i_pts > 0 ? p_block->i_pts : p_block->i_dts;
> diff --git a/modules/video_filter/adjust.c b/modules/video_filter/adjust.c
> index 9bb16ab..7d0da3c 100644
> --- a/modules/video_filter/adjust.c
> +++ b/modules/video_filter/adjust.c
> @@ -459,7 +459,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic )
>         return NULL;
>     }
>
> -    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
> +    p_outpic = filter_NewPicture( p_filter );
>     if( !p_outpic )
>     {
>         msg_Warn( p_filter, "can't get output picture" );
> diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
> index 08e6809..9f9bef4 100644
> --- a/modules/video_filter/canvas.c
> +++ b/modules/video_filter/canvas.c
> @@ -285,13 +285,12 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
>  *****************************************************************************/
>  static picture_t *video_new( filter_t *p_filter )
>  {
> -    return ((filter_t*)p_filter->p_owner)->pf_vout_buffer_new( (filter_t*)p_filter->p_owner );
> +    return filter_NewPicture( (filter_t*)p_filter->p_owner );
>  }
>
>  static void video_del( filter_t *p_filter, picture_t *p_pic )
>  {
> -    if( ((filter_t*)p_filter->p_owner)->pf_vout_buffer_del )
> -        ((filter_t*)p_filter->p_owner)->pf_vout_buffer_del( (filter_t*)p_filter->p_owner, p_pic );
> +    return filter_DeletePicture( (filter_t*)p_filter->p_owner, p_pic );
>  }
>
>  static int alloc_init( filter_t *p_filter, void *p_data )
> diff --git a/modules/video_filter/chain.c b/modules/video_filter/chain.c
> index fa8650b..7ea91eb 100644
> --- a/modules/video_filter/chain.c
> +++ b/modules/video_filter/chain.c
> @@ -220,13 +220,13 @@ static picture_t *BufferNew( filter_t *p_filter )
>  {
>     filter_t *p_parent = (filter_t*)p_filter->p_owner;
>
> -    return p_parent->pf_vout_buffer_new( p_parent );
> +    return filter_NewPicture( p_parent );
>  }
>  static void BufferDel( filter_t *p_filter, picture_t *p_pic )
>  {
>     filter_t *p_parent = (filter_t*)p_filter->p_owner;
>
> -    p_parent->pf_vout_buffer_del( p_parent, p_pic );
> +    return filter_DeletePicture( p_parent, p_pic );
>  }
>  static int BufferAllocationInit ( filter_t *p_filter, void *p_data )
>  {
> diff --git a/modules/video_filter/swscale_maemo.c b/modules/video_filter/swscale_maemo.c
> index dd94ed2..6356ca2 100644
> --- a/modules/video_filter/swscale_maemo.c
> +++ b/modules/video_filter/swscale_maemo.c
> @@ -186,7 +186,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
>         return NULL;
>
>     /* Request output picture */
> -    p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
> +    p_pic_dst = filter_NewPicture( p_filter );
>     if( !p_pic_dst )
>     {
>         msg_Warn( p_filter, "can't get output picture" );
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>

Hi,

This patch hasn't been applied to 1.0-bugfix, which causes a memory
leak inside of the invmem codec (since both lines are present)
Since it causes a bug, here comes a little patch to fix this, I let
choose what to do with the others ;)

Regards,

-- 
Hugo Beauzée-Luyssen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Avoid-leaking-images-in-invmem-codec.patch
Type: text/x-patch
Size: 901 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090528/ee98cd19/attachment.bin>


More information about the vlc-devel mailing list