From 5b7c19ee73267848cdb04283261c17e8b4e39361 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 15 Nov 2011 23:59:59 +0000 Subject: [PATCH] paranoid locking --- panda/src/movies/ffmpegVideoCursor.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/panda/src/movies/ffmpegVideoCursor.cxx b/panda/src/movies/ffmpegVideoCursor.cxx index ec19a40dad..3913503ef1 100644 --- a/panda/src/movies/ffmpegVideoCursor.cxx +++ b/panda/src/movies/ffmpegVideoCursor.cxx @@ -952,6 +952,10 @@ seek(int frame, bool backward) { static PStatCollector seek_pcollector("*:FFMPEG Video Decoding:Seek"); PStatTimer timer(seek_pcollector); + // Protect the call to av_seek_frame() in a global lock, just to be + // paranoid. + ReMutexHolder av_holder(_av_lock); + PN_int64 target_ts = (PN_int64)frame; if (target_ts < (PN_int64)(_initial_dts)) { // Attempts to seek before the first packet will fail. @@ -992,8 +996,6 @@ seek(int frame, bool backward) { // it, and don't do this. /* - ReMutexHolder av_holder(_av_lock); - avcodec_close(_video_ctx); AVCodec *pVideoCodec = avcodec_find_decoder(_video_ctx->codec_id); if (pVideoCodec == 0) {