Commit b4874f9c authored by Rafaël Carré's avatar Rafaël Carré Committed by Felix Paul Kühne

Workaround broken picture_t refcounting and destruction

Prefer huge memory leaks over segmentation faults
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent a07eb037
......@@ -2,7 +2,7 @@
* fake.c: decoder reading from a fake stream, outputting a fixed image
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
* $Id: 5d0edc4ffad92bac6f75a7f25148cce0de1ef48d $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -222,6 +222,7 @@ static int OpenDecoder( vlc_object_t *p_this )
}
else
{
if( p_old->pf_release )
p_old->pf_release( p_old );
}
}
......@@ -259,6 +260,7 @@ static int OpenDecoder( vlc_object_t *p_this )
}
else
{
if( p_old->pf_release )
p_old->pf_release( p_old );
}
}
......@@ -309,6 +311,6 @@ static void CloseDecoder( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t *)p_this;
picture_t *p_image = (picture_t *)p_dec->p_sys;
if( p_image != NULL )
if( p_image && p_image->pf_release )
p_image->pf_release( p_image );
}
......@@ -424,6 +424,7 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
if( !p_pic_dst )
{
msg_Warn( p_filter, "can't get output picture" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return NULL;
}
......@@ -600,6 +601,7 @@ static picture_t *Process( filter_t *p_filter, picture_t *p_pic )
p_pic_dst->b_progressive = p_pic->b_progressive;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......@@ -690,6 +692,7 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
p_pic_dst->b_progressive = VLC_TRUE;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......@@ -2,7 +2,7 @@
* file_bitmap.cpp
*****************************************************************************
* Copyright (C) 2003 the VideoLAN team
* $Id$
* $Id: b41a79650fc8e90754fc31ad4e1e8f931a11c684 $
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
* Olivier Teulière <ipkiss@via.ecp.fr>
......@@ -73,6 +73,7 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
pSrc += pPic->p->i_pitch - m_width * 4;
}
if( pPic->pf_release )
pPic->pf_release( pPic );
return;
}
......
......@@ -367,6 +367,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
while ( p_es->p_picture )
{
picture_t *p_next = p_es->p_picture->p_next;
if( p_es->p_picture->pf_release )
p_es->p_picture->pf_release( p_es->p_picture );
p_es->p_picture = p_next;
}
......@@ -473,6 +474,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
if ( p_new_pic == NULL )
{
msg_Err( p_stream, "image conversion failed" );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
continue;
}
......@@ -488,6 +490,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
p_sys->p_decoder->fmt_out.video.i_aspect )
!= VLC_SUCCESS )
{
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
free( p_new_pic );
continue;
......@@ -503,6 +506,7 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
p_new_pic->pf_release = ReleasePicture;
p_new_pic->date = p_pic->date;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
PushPicture( p_stream, p_new_pic );
}
......@@ -604,6 +608,7 @@ static picture_t *video_new_buffer( decoder_t *p_dec )
for( i = 0; i < PICTURE_RING_SIZE; i++ )
{
if( pp_ring[i]->pf_release )
pp_ring[i]->pf_release( pp_ring[i] );
pp_ring[i] = NULL;
}
......
......@@ -2040,6 +2040,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
{
msg_Dbg( p_stream, "late picture skipped ("I64Fd")",
current_date + 50000 - p_pic->date );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
continue;
}
......@@ -2071,6 +2072,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
msg_Dbg( p_stream, "dropping frame (%i)",
(int)(i_video_drift - i_master_drift) );
#endif
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
continue;
}
......@@ -2088,6 +2090,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
{
if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )
{
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
transcode_video_close( p_stream, id );
id->b_transcode = VLC_FALSE;
......@@ -2185,6 +2188,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
vlc_object_detach( id->pp_filter[id->i_filter] );
vlc_object_destroy( id->pp_filter[id->i_filter] );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
transcode_video_close( p_stream, id );
id->b_transcode = VLC_FALSE;
......@@ -2264,6 +2268,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
if( p_tmp )
{
vout_CopyPicture( p_stream, p_tmp, p_pic );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
p_pic = p_tmp;
}
......@@ -2342,6 +2347,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
if( p_sys->i_threads == 0 )
{
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
}
else
......@@ -2395,6 +2401,7 @@ static int EncoderThread( sout_stream_sys_t *p_sys )
vlc_mutex_unlock( &p_sys->lock_out );
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
}
......@@ -2403,6 +2410,7 @@ static int EncoderThread( sout_stream_sys_t *p_sys )
p_pic = p_sys->pp_pics[p_sys->i_first_pic++];
p_sys->i_first_pic %= PICTURE_RING_SIZE;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
}
......@@ -2479,6 +2487,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, picture_t **pp_ring,
for( i = 0; i < PICTURE_RING_SIZE; i++ )
{
if( pp_ring[i]->pf_release )
pp_ring[i]->pf_release( pp_ring[i] );
}
......
......@@ -2,7 +2,7 @@
* deinterlace.c : deinterlacer plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001, 2002, 2003 the VideoLAN team
* $Id$
* $Id: 68aade2f54e0416a26cbb98302d73d644bb8ca20 $
*
* Author: Sam Hocevar <sam@zoy.org>
*
......@@ -2137,6 +2137,7 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
RenderDiscard( p_vout, p_pic_dst, p_pic, 0 );
#endif
msg_Err( p_vout, "discarding lines is not supported yet" );
if( p_pic_dst->pf_release )
p_pic_dst->pf_release( p_pic_dst );
return p_pic;
break;
......@@ -2154,6 +2155,7 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
RenderLinear( p_vout, pp_outpic[1], p_pic, 1 );
#endif
msg_Err( p_vout, "doubling the frame rate is not supported yet" );
if( p_pic_dst->pf_release )
p_pic_dst->pf_release( p_pic_dst );
return p_pic;
break;
......@@ -2176,7 +2178,7 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
p_pic_dst->i_nb_fields = p_pic->i_nb_fields;
p_pic_dst->b_progressive = VLC_TRUE;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......
......@@ -2,7 +2,7 @@
* distort.c : Misc video effects plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2006 the VideoLAN team
* $Id$
* $Id: 5a347bc784e6f61e1cfa17e975c87c039e3f76ea $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Antoine Cellerier <dionoea -at- videolan -dot- org>
......@@ -1037,7 +1037,7 @@ static void DistortPsychedelic( vout_thread_t *p_vout, picture_t *p_inpic,
copyimage( U_PLANE, 1 );
copyimage( V_PLANE, 1 );
#undef copyimage
if( p_converted->pf_release )
p_converted->pf_release( p_converted );
p_vout->p_sys->x += p_vout->p_sys->xinc;
......
......@@ -2,7 +2,7 @@
* logo.c : logo video plugin for vlc
*****************************************************************************
* Copyright (C) 2003-2006 the VideoLAN team
* $Id$
* $Id: 3a2d3a04890dcc67a32113dabb5ecc97f123577d $
*
* Authors: Gildas Bazin <gbazin@videolan.org>
* Simon Latapie <garf@videolan.org>
......@@ -268,6 +268,7 @@ void FreeLogoList( logo_list_t *p_logo_list )
if( p_logo->psz_file ) FREE( p_logo->psz_file );
if( p_logo->p_pic )
{
if( p_logo->p_pic->pf_release )
p_logo->p_pic->pf_release( p_logo->p_pic );
p_logo->p_pic = NULL;
}
......
......@@ -2,7 +2,7 @@
* magnify.c : Magnify/Zoom interactive effect
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
* $Id: 63401230ab8e2838b9fbacd3819114e139371a1e $
*
* Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
*
......@@ -288,6 +288,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
copyimage( U_PLANE );
copyimage( V_PLANE );
#undef copyimage
if( p_converted->pf_release )
p_converted->pf_release( p_converted );
/* white rectangle on visualization */
......
......@@ -381,7 +381,7 @@ static void DestroyFilter( vlc_object_t *p_this )
var_Destroy( p_libvlc, "mosaic-bsvt" );
var_Destroy( p_libvlc, "mosaic-bs" );
if( p_sys->p_pic ) p_sys->p_pic->pf_release( p_sys->p_pic );
if( p_sys->p_pic && p_sys->p_pic->pf_release ) p_sys->p_pic->pf_release( p_sys->p_pic );
vlc_mutex_unlock( &p_sys->lock );
vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
......@@ -394,6 +394,7 @@ static void MosaicReleasePicture( picture_t *p_picture )
{
picture_t *p_original_pic = (picture_t *)p_picture->p_sys;
if( p_original_pic->pf_release )
p_original_pic->pf_release( p_original_pic );
}
......@@ -496,6 +497,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if ( p_es->p_picture->p_next != NULL )
{
picture_t *p_next = p_es->p_picture->p_next;
if( p_es->p_picture->pf_release )
p_es->p_picture->pf_release( p_es->p_picture );
p_es->p_picture = p_next;
}
......@@ -503,6 +505,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
date )
{
/* Display blank */
if( p_es->p_picture->pf_release )
p_es->p_picture->pf_release( p_es->p_picture );
p_es->p_picture = NULL;
p_es->pp_last = &p_es->p_picture;
......
......@@ -2,7 +2,7 @@
* rss.c : rss/atom feed display video plugin for vlc
*****************************************************************************
* Copyright (C) 2003-2006 the VideoLAN team
* $Id$
* $Id: 8e480533844961d3eab9f92c9773b0df1418b1e9 $
*
* Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
*
......@@ -522,6 +522,7 @@ picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
fmt_out.i_height = p_sys->p_style->i_font_size;
p_pic = image_Convert( p_handler, p_orig, &fmt_in, &fmt_out );
if( p_orig->pf_release )
p_orig->pf_release( p_orig );
if( !p_pic )
{
......@@ -895,7 +896,7 @@ static void FreeRSS( filter_t *p_filter)
free( p_feed->psz_link );
free( p_feed->psz_description );
free( p_feed->psz_image );
if( p_feed->p_pic != NULL )
if( p_feed->p_pic && p_feed->p_pic->pf_release )
p_feed->p_pic->pf_release( p_feed->p_pic );
}
free( p_sys->p_feeds );
......
......@@ -2,7 +2,7 @@
* rv32.c: conversion plugin to RV32 format.
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* $Id$
* $Id: 3d056cd697f4ea8131a3accf76fbbe3504b10e6c $
*
* Author: Cyril Deguet <asmax@videolan.org>
*
......@@ -140,6 +140,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_pic_dst->b_progressive = p_pic->b_progressive;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......
......@@ -3,7 +3,7 @@
* Uses the low quality "nearest neighbour" algorithm.
*****************************************************************************
* Copyright (C) 2003 the VideoLAN team
* $Id$
* $Id: fde9f41689fe615649e0431f705af1fc53ecffbd $
*
* Author: Gildas Bazin <gbazin@videolan.org>
*
......@@ -154,6 +154,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_pic_dst->b_progressive = p_pic->b_progressive;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......@@ -2,7 +2,7 @@
* filter.c: video scaling module using the swscale library
*****************************************************************************
* Copyright (C) 2003 the VideoLAN team
* $Id$
* $Id: e3c50ecacc4fc2d77bc3f91dd67d06ff6aa9d06b $
*
* Author: Gildas Bazin <gbazin@videolan.org>
*
......@@ -304,6 +304,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_pic_dst->b_progressive = p_pic->b_progressive;
p_pic_dst->b_top_field_first = p_pic->b_top_field_first;
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return p_pic_dst;
}
......
......@@ -130,7 +130,7 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
while( (p_tmp = p_image->p_dec->pf_decode_video( p_image->p_dec, &p_block ))
!= NULL )
{
if ( p_pic != NULL )
if ( p_pic && p_pic->pf_release )
p_pic->pf_release( p_pic );
p_pic = p_tmp;
}
......@@ -179,6 +179,7 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
if( !p_image->p_filter )
{
if( p_pic->pf_release )
p_pic->pf_release( p_pic );
return NULL;
}
......
......@@ -2,7 +2,7 @@
* vout_intf.c : video output interface
*****************************************************************************
* Copyright (C) 2000-2006 the VideoLAN team
* $Id$
* $Id: 2eb4dace95571141c0ae9db43c43baa88fbf44ef $
*
* Authors: Gildas Bazin <gbazin@videolan.org>
*
......@@ -704,6 +704,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
p_subpic = spu_CreateSubpicture( p_vout->p_spu );
if( p_subpic == NULL )
{
if( p_pif->pf_release )
p_pif->pf_release( p_pif );
return VLC_EGENERIC;
}
......@@ -719,6 +720,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
p_subpic->p_region = spu_CreateRegion( p_vout->p_spu, &fmt_out );
vout_CopyPicture( p_image->p_parent, &p_subpic->p_region->picture,
p_pif );
if( p_pif->pf_release )
p_pif->pf_release( p_pif );
spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment