[Libav-user] avpicture_free crashing when using with sws_scale()
Pradeep Karosiya
praks411 at gmail.com
Wed Jun 26 12:25:55 CEST 2013
Hi Stefano,
Thanks for your explanation. However I didn't get about your point on
fill pic with data and destroying previously allocating data.
I've buffer filled with image data and I want to create AVPicture object
from it so that it can
be encoded to video. The inpic is used as temporary storage for conversion
with input pix_format is different than required pix_format. Thats why I
used
AVPicture inpic
avpicture_alloc(&inpic,(PixelFormat)input_pix_fmt, width, height);
avpicture_fill(&inpic, (uint8_t*)buf, (PixelFormat)input_pix_fmt,
width, height);
First I'm allocating AVPicture then I'm filling it with data from buf. And
finally after conversion
I'm destroying it. But you said that there will be leak on call of
avpicture_fill which is correct
as I'm also seeing the leaking in my code.
So what is the best way to do this without leak.
I've also tried following
void WriteFrame(const uint8_t*buf)
{
const uint8_t *indata[1] = {buf};
int inlinesize[1] = {3*width};
if (sws_scale(img_convert_ctx, indata, inlinesize, 0,height,
dst_picture.data, dst_picture.linesize) < 0 )
{
std::cout<<"Conversion Failed "<<std::endl;
}
else
{
avpicture_fill(&dst_picture, (uint8_t*)buf, (PixelFormat)input_pix_fmt,
width, height);
}
//Here I'm encoding dst_picture
}
But above is also giving me leaks. Also I'm getting these leaks only when
I'm encoding both audio and video(when using av_interleaved_write_frame). If
I encode just video then there is no leaks.
Please suggest me as I've spend quite a time in debugging this issue.
Thanks
Pradeep
--
View this message in context: http://libav-users.943685.n4.nabble.com/avpicture-free-crashing-when-using-with-sws-scale-tp4658017p4658034.html
Sent from the libav-users mailing list archive at Nabble.com.
More information about the Libav-user
mailing list