Browse Source

ffmpeg: don't hold AV lock while fetching first packet/frame

This allows loading multiple videos side-by-side more effectively.

Closes #397
rdb 7 years ago
parent
commit
8cb7f7d9c0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      panda/src/ffmpeg/ffmpegVideoCursor.cxx

+ 2 - 2
panda/src/ffmpeg/ffmpegVideoCursor.cxx

@@ -79,8 +79,6 @@ init_from(FfmpegVideo *source) {
     return;
     return;
   }
   }
 
 
-  ReMutexHolder av_holder(_av_lock);
-
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101)
 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 45, 101)
   _frame = av_frame_alloc();
   _frame = av_frame_alloc();
   _frame_out = av_frame_alloc();
   _frame_out = av_frame_alloc();
@@ -109,6 +107,8 @@ init_from(FfmpegVideo *source) {
   _eof_known = false;
   _eof_known = false;
   _eof_frame = 0;
   _eof_frame = 0;
 
 
+  ReMutexHolder av_holder(_av_lock);
+
   // Check if we got an alpha format.  Please note that some video codecs
   // Check if we got an alpha format.  Please note that some video codecs
   // (eg. libvpx) change the pix_fmt after decoding the first frame, which is
   // (eg. libvpx) change the pix_fmt after decoding the first frame, which is
   // why we didn't do this earlier.
   // why we didn't do this earlier.