On Fri, 4 Jul 2014 16:09:53 +0200 Info || Non-Lethal Applications <[email protected]> wrote:
> Hey guys, > > I’m creating a recording application and I have an incoming frame which I’d > like to convert to JPEG without writing it to a movie file. > However, I need to use libav’s V210 decoder before creating the JPEG data. > > I’m getting a memory leak in this code: > > AVPacket pkt; > av_init_packet(&pkt); > > pkt.flags |= AV_PKT_FLAG_KEY; > pkt.stream_index = 0; > pkt.data = imgData; > pkt.size = ... > > int gotPctr = 0; > > AVFrame* frameGrabFrame = av_frame_alloc(); > avcodec_decode_video2(_pV210CodecCtxFrameGrab, frameGrabFrame, &gotPctr, > &pkt); > > I get a memory consumption increase of about 13 MB after the avcodec_decode > call. > However, I can’t manage to free the memory. I already tried without success: > > av_free_packet(&pkt); > av_frame_unref(frameGrabFrame); > av_frame_free(&frameGrabFrame); This should be correct. av_frame_free() already calls av_frame_unref(), but on the other hand calling av_frame_unref() multiple time is perfectly ok. > > I’m not using reference counting by the way. > I’m sure that’s a dumb one … sorry for that. > > Any advice appreciated! > Thanks! _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
