[Libav-user] avpicture_free crashing when using with sws_scale()
praks411 at gmail.com
Tue Jun 25 12:52:41 CEST 2013
I'm trying to encode images into video. I'm following muxing.c and scaling.c
Though I'm able to encode a video, I'm not able to get rid of memory leaks.
I tried many different things
related related to allocation of AVPicture but still memory leaks.
Specifically my code crashed when I call avpicture_free due to heap error.
Here is the snippet of code
void WriteFrame(const uchar* buf) //Input buffer contained image data
avpicture_alloc(&inpic,(PixelFormat)input_pix_fmt, width, height);
avpicture_fill(&inpic, (uint8_t*)buf, (PixelFormat)input_pix_fmt,
struct SwsContext *img_convert_ctx = NULL;
img_convert_ctx = sws_getContext(
NULL, NULL, NULL);
dst_picture.linesize) < 0 )
std::cout<<"Conversion Failed "<<std::endl
avpicture_free(&inpic); //Crashing here
//Here I'm encoding the image into video
So no matter where I put my avpicture_free(&inpic) this is always crashing.
However If no conversion is required the everything works fine. Even if I
create inpic as global similar to dst_picture it again crashed.
Please suggest what could be going wrong.
Thanks and Regards,
View this message in context: http://libav-users.943685.n4.nabble.com/avpicture-free-crashing-when-using-with-sws-scale-tp4658017.html
Sent from the libav-users mailing list archive at Nabble.com.
More information about the Libav-user