[FFmpeg-devel] Threading issue with avcodec_decode_video2 ?
donmoir at comcast.net
Thu Oct 25 22:17:23 CEST 2012
I load up multiple instances of the same file. These are used for playback, thumbnails, and other things. Each is in a separate thread with their own context, variables, etc.
We noticed a crash when decoding WMV3 files. It's was a rare event so hard to track down.
Recently I put some code in to help find the problem. It seems that avcodec_decode_video2 is not thread safe at least for WMV3 decoding.
I have disable-pthreads set. I use av_lockmgr_register and see it allows a lock for avformat and avcodec. The lock for avcodec never gets called.
If I put a lock around avcodec_decode_video2, the problem goes away. After several crashes that led nowhere, I isolated it to avcodec_decode_video2.
Shouldn't related decoders be setting the lock via the lock manager if needed ?
I don't want to have to lock the entire avcodec_decode_video2 call and lock should be special cased for each decoder and so I am left wondering.
My app is designed for windows so it's a bitch to trace into ffmpeg and I am assuming decoder for WMV3 is in vc1dec.c
Next thing for me would be to move the source code for vc1dec.c into my own app so I can see exactly where the problem is and this takes time.
More information about the ffmpeg-devel