Commit 8fdad6da authored by smorlat's avatar smorlat
Browse files

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
parent 7b0fc556
...@@ -503,8 +503,12 @@ static void dec_process(MSFilter *f){ ...@@ -503,8 +503,12 @@ static void dec_process(MSFilter *f){
while (end-p>0) { while (end-p>0) {
int len; int len;
int got_picture=0; int got_picture=0;
AVPacket pkt;
avcodec_get_frame_defaults(&orig); 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) { if (len<=0) {
ms_warning("ms_AVdecoder_process: error %i.",len); ms_warning("ms_AVdecoder_process: error %i.",len);
break; break;
......
...@@ -28,9 +28,11 @@ static void yuv_buf_init(YuvBuf *buf, int w, int h, uint8_t *ptr){ ...@@ -28,9 +28,11 @@ static void yuv_buf_init(YuvBuf *buf, int w, int h, uint8_t *ptr){
buf->planes[0]=ptr; buf->planes[0]=ptr;
buf->planes[1]=buf->planes[0]+ysize; buf->planes[1]=buf->planes[0]+ysize;
buf->planes[2]=buf->planes[1]+usize; buf->planes[2]=buf->planes[1]+usize;
buf->planes[3]=0;
buf->strides[0]=w; buf->strides[0]=w;
buf->strides[1]=w/2; buf->strides[1]=w/2;
buf->strides[2]=buf->strides[1]; buf->strides[2]=buf->strides[1];
buf->strides[3]=0;
} }
int yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){ int yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){
......
...@@ -46,13 +46,17 @@ static mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize){ ...@@ -46,13 +46,17 @@ static mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize){
AVPicture dest; AVPicture dest;
mblk_t *ret; mblk_t *ret;
struct SwsContext *sws_ctx; struct SwsContext *sws_ctx;
AVPacket pkt;
avcodec_get_context_defaults(&av_context); avcodec_get_context_defaults(&av_context);
if (avcodec_open(&av_context,avcodec_find_decoder(CODEC_ID_MJPEG))<0){ if (avcodec_open(&av_context,avcodec_find_decoder(CODEC_ID_MJPEG))<0){
ms_error("jpeg2yuv: avcodec_open failed"); ms_error("jpeg2yuv: avcodec_open failed");
return NULL; 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"); ms_error("jpeg2yuv: avcodec_decode_video failed");
avcodec_close(&av_context); avcodec_close(&av_context);
return NULL; return NULL;
......
...@@ -261,7 +261,12 @@ static void dec_process_frame(MSFilter *f, mblk_t *inm){ ...@@ -261,7 +261,12 @@ static void dec_process_frame(MSFilter *f, mblk_t *inm){
frame=s->input; frame=s->input;
s->input=NULL; s->input=NULL;
while ( (remain=frame->b_wptr-frame->b_rptr)> 0) { 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) { if (len<=0) {
ms_warning("ms_AVdecoder_process: error %i.",len); ms_warning("ms_AVdecoder_process: error %i.",len);
break; break;
......
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