[Libav-user] OpenCV VideoCapture FFmpeg Module Bug on Linux using Video without a Codec
nfxjfg at googlemail.com
Thu Mar 5 15:32:01 CET 2015
On Thu, 5 Mar 2015 15:25:41 +0100
"Johannes Rehm" <hahne.rehm at gmx.de> wrote:
> okay I could use some tools like valgrind, but first I wanted to understand what is goigng on here.
> Also I cannot test every case with valgrind as this code should work with different versions of ffmpeg and various kind of videos.
> But anyway thanks for this idea, I might use it after I (might) figured out how to fix this bug correctly
> My main question is: why / how does
> av_free_packet (&packet);
> the AVFrame picture (set here: avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet);)? And why is this only the case for a raw video input?
It could be that av_free_packet() (or any other call) corrupts the
heap, which then makes code run later crash (such as decoding).
Also, raw video does something special: the AVFrames it outputs keep a
reference to the packet's buffer. But with correct API usage, this
should be 100% transparent.
> If I find out why this is the case I hope to be able to fix this without introducing a memory leak (or you can tell me that I am completly going in the wrong direction).
More information about the Libav-user