[Libav-user] sws_scale crashes

黄轩宇 xuanyu.huang at gmail.com
Thu May 2 14:53:03 CEST 2013


Hi Guys,

I met a crash when doing image conversion (just pixel format conversion, no
resizing).

sws_context is got using sws_getContext (I also tried sws_getCachedContext)

code fragment is here:

pFrameConverted = avcodec_alloc_frame();

int numBytes = avpicture_get_size(LPixelFormatToFFMPEG(vfSource.pf),
vfSource.iWidth, vfSource.iHeight);

buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

avpicture_fill((AVPicture *)pFrameConverted, buffer,
LPixelFormatToFFMPEG(vfSource.pf), vfSource.iWidth, vfSource.iHeight);


// pCurrentFrame is the AVFrame object returned by av_decode_video2

sws_scale(pSwsContext, pCurrentFrame->data, pCurrentFrame->linesize, 0,
vfSource.iHeight, pFrameConverted->data, pFrameConverted->linesize) ;


sws_scale crashes randomly (crashes in different frames).


Can anyone provide any idea on this?


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130502/5e050f7c/attachment.html>


More information about the Libav-user mailing list