Fix compiling with latest ffmpeg master
Propperly lock ffmpeg