From 8fdad6daa38797ab9e78ba14c0add490398ac4cb Mon Sep 17 00:00:00 2001 From: smorlat Date: Thu, 16 Apr 2009 13:46:48 +0000 Subject: [PATCH] update to lastest ffmpeg and fix a crash produced by changes in swscale processing. git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@421 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/mediastreamer2/plugins/msx264/src/msx264.c | 6 +++++- linphone/mediastreamer2/src/msvideo.c | 2 ++ linphone/mediastreamer2/src/nowebcam.c | 6 +++++- linphone/mediastreamer2/src/videodec.c | 7 ++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/linphone/mediastreamer2/plugins/msx264/src/msx264.c b/linphone/mediastreamer2/plugins/msx264/src/msx264.c index 19ce85a30..1cd1d7b6d 100644 --- a/linphone/mediastreamer2/plugins/msx264/src/msx264.c +++ b/linphone/mediastreamer2/plugins/msx264/src/msx264.c @@ -503,8 +503,12 @@ static void dec_process(MSFilter *f){ while (end-p>0) { int len; int got_picture=0; + AVPacket pkt; avcodec_get_frame_defaults(&orig); - len=avcodec_decode_video(&d->av_context,&orig,&got_picture,p,end-p); + av_init_packet(&pkt); + pkt.data = p; + pkt.size = end-p; + len=avcodec_decode_video2(&d->av_context,&orig,&got_picture,&pkt); if (len<=0) { ms_warning("ms_AVdecoder_process: error %i.",len); break; diff --git a/linphone/mediastreamer2/src/msvideo.c b/linphone/mediastreamer2/src/msvideo.c index 3c998e265..4cd313c94 100644 --- a/linphone/mediastreamer2/src/msvideo.c +++ b/linphone/mediastreamer2/src/msvideo.c @@ -28,9 +28,11 @@ static void yuv_buf_init(YuvBuf *buf, int w, int h, uint8_t *ptr){ buf->planes[0]=ptr; buf->planes[1]=buf->planes[0]+ysize; buf->planes[2]=buf->planes[1]+usize; + buf->planes[3]=0; buf->strides[0]=w; buf->strides[1]=w/2; buf->strides[2]=buf->strides[1]; + buf->strides[3]=0; } int yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){ diff --git a/linphone/mediastreamer2/src/nowebcam.c b/linphone/mediastreamer2/src/nowebcam.c index 6b15f0f92..2afbba5d6 100644 --- a/linphone/mediastreamer2/src/nowebcam.c +++ b/linphone/mediastreamer2/src/nowebcam.c @@ -46,13 +46,17 @@ static mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize){ AVPicture dest; mblk_t *ret; struct SwsContext *sws_ctx; + AVPacket pkt; avcodec_get_context_defaults(&av_context); if (avcodec_open(&av_context,avcodec_find_decoder(CODEC_ID_MJPEG))<0){ ms_error("jpeg2yuv: avcodec_open failed"); return NULL; } - if (avcodec_decode_video(&av_context,&orig,&got_picture,jpgbuf,bufsize)<0){ + av_init_packet(&pkt); + pkt.data=jpgbuf; + pkt.size=bufsize; + if (avcodec_decode_video2(&av_context,&orig,&got_picture,&pkt)<0){ ms_error("jpeg2yuv: avcodec_decode_video failed"); avcodec_close(&av_context); return NULL; diff --git a/linphone/mediastreamer2/src/videodec.c b/linphone/mediastreamer2/src/videodec.c index c267b4a9b..57654c907 100644 --- a/linphone/mediastreamer2/src/videodec.c +++ b/linphone/mediastreamer2/src/videodec.c @@ -261,7 +261,12 @@ static void dec_process_frame(MSFilter *f, mblk_t *inm){ frame=s->input; s->input=NULL; while ( (remain=frame->b_wptr-frame->b_rptr)> 0) { - len=avcodec_decode_video(&s->av_context,&orig,&got_picture,(uint8_t*)frame->b_rptr,remain ); + AVPacket pkt; + av_init_packet(&pkt); + pkt.data = frame->b_rptr; + pkt.size = remain; + len=avcodec_decode_video2(&s->av_context,&orig,&got_picture,&pkt); + /*len=avcodec_decode_video(&s->av_context,&orig,&got_picture,(uint8_t*)frame->b_rptr,remain );*/ if (len<=0) { ms_warning("ms_AVdecoder_process: error %i.",len); break;