diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-03-22 18:24:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-03-22 18:27:35 +0300 |
commit | fb1265c5cf24462985cd3debae9205ac78f5d6ab (patch) | |
tree | 1b27f02a7d9c3b6ed7facc1cc20d4d1ef4c06325 /source/blender/blenkernel/intern/movieclip.c | |
parent | 4b9c9a7bea4a004a2b1d95e0a41c90b05637dca9 (diff) |
Tracking: Fix movie file prefetch freezing interface
The issue was caused by the prefetch code having LOCK_MOVIECLIP lock
acquired while reading frames from the movie files. The need of the
lock was coming from the fact that `clip->anim` can not be accessed
from multiple threads, so that was guarded by a lock. The side effect
of this lock was that the main thread (from which drawing is happening)
did not have any chance passing through it in the cache code because
the prefetch happens so quickly.
The solution is to create a local copy of the clip with its own
anim handler, so that read can happen without such lock.
The prefetch is slower by an absolute number in seconds (within 10%
in tests here), but it is interactive now.
Diffstat (limited to 'source/blender/blenkernel/intern/movieclip.c')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 017a73593ee..9c2cd03dbc2 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1958,14 +1958,12 @@ void BKE_movieclip_filename_for_frame(MovieClip *clip, MovieClipUser *user, char } } -ImBuf *BKE_movieclip_anim_ibuf_for_frame(MovieClip *clip, MovieClipUser *user) +ImBuf *BKE_movieclip_anim_ibuf_for_frame_no_lock(MovieClip *clip, MovieClipUser *user) { ImBuf *ibuf = NULL; if (clip->source == MCLIP_SRC_MOVIE) { - BLI_thread_lock(LOCK_MOVIECLIP); ibuf = movieclip_load_movie_file(clip, user, user->framenr, clip->flag); - BLI_thread_unlock(LOCK_MOVIECLIP); } return ibuf; |