I am using LIBAV on Ubuntu to save user's video stream(RTP VP8) on server in WebM format. The problem is, memory is leaking when using av_write_frame. Memory usage is constantly growing (equally with the webm file size) and is never freed after finishing the video recording. The only way to free the memory(RAM) is deleting the WebM file from the storage (HD) afterwards.
I have 2 questions:
- Is it possible to free the memory consumed by
av_write_frame
during runtime? I am freeing thepacket.data
correctly. Memory usage is not growing whenav_write_frame
line is commented. What is the correct way to close the file? This is what I'm doing (it does not free the memory):
av_write_trailer(fctx); avcodec_close(vStream->codec); avio_close(fctx->pb); avformat_free_context(fctx);