[vlc-devel] commit: Don't crash when deinterlacing fails. (Jean-Paul Saman )
git version control
git at videolan.org
Mon Mar 31 12:09:22 CEST 2008
vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Fri Mar 28 13:44:29 2008 +0100| [9e856ef47f531cd138ad685c697d4dc7a7467975]
Don't crash when deinterlacing fails.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e856ef47f531cd138ad685c697d4dc7a7467975
---
modules/codec/ffmpeg/deinterlace.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/modules/codec/ffmpeg/deinterlace.c b/modules/codec/ffmpeg/deinterlace.c
index 3fc6f38..23077e9 100644
--- a/modules/codec/ffmpeg/deinterlace.c
+++ b/modules/codec/ffmpeg/deinterlace.c
@@ -119,15 +119,12 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
filter_sys_t *p_sys = p_filter->p_sys;
AVPicture src_pic, dest_pic;
picture_t *p_pic_dst;
- int i;
+ int i, i_res = -1;
/* Request output picture */
p_pic_dst = p_filter->pf_vout_buffer_new( p_filter );
if( !p_pic_dst )
- {
- msg_Warn( p_filter, "can't get output picture" );
return NULL;
- }
/* Prepare the AVPictures for the conversion */
for( i = 0; i < p_pic->i_planes; i++ )
@@ -141,10 +138,15 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
dest_pic.linesize[i] = p_pic_dst->p[i].i_pitch;
}
- avpicture_deinterlace( &dest_pic, &src_pic, p_sys->i_src_ffmpeg_chroma,
- p_filter->fmt_in.video.i_width,
- p_filter->fmt_in.video.i_height );
-
+ i_res = avpicture_deinterlace( &dest_pic, &src_pic, p_sys->i_src_ffmpeg_chroma,
+ p_filter->fmt_in.video.i_width,
+ p_filter->fmt_in.video.i_height );
+ if( i_res == -1 )
+ {
+ msg_Err( p_filter, "deinterlacing picture failed" );
+ p_filter->pf_vout_buffer_del( p_filter, p_pic_dst );
+ return NULL;
+ }
p_pic_dst->date = p_pic->date;
p_pic_dst->b_force = p_pic->b_force;
p_pic_dst->i_nb_fields = p_pic->i_nb_fields;
More information about the vlc-devel
mailing list