Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2021-03-22 18:24:03 +0300
committerSergey Sharybin <sergey@blender.org>2021-03-22 18:27:35 +0300
commitfb1265c5cf24462985cd3debae9205ac78f5d6ab (patch)
tree1b27f02a7d9c3b6ed7facc1cc20d4d1ef4c06325 /source/blender/blenkernel/BKE_movieclip.h
parent4b9c9a7bea4a004a2b1d95e0a41c90b05637dca9 (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/BKE_movieclip.h')
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index d33eabeb7e0..067dc694109 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -102,8 +102,11 @@ float BKE_movieclip_remap_clip_to_scene_frame(const struct MovieClip *clip, floa
void BKE_movieclip_filename_for_frame(struct MovieClip *clip,
struct MovieClipUser *user,
char *name);
-struct ImBuf *BKE_movieclip_anim_ibuf_for_frame(struct MovieClip *clip,
- struct MovieClipUser *user);
+
+/* Read image buffer from the given movie clip without acquiring the `LOCK_MOVIECLIP` lock.
+ * Used by a prefetch job which takes care of creating a local copy of the clip. */
+struct ImBuf *BKE_movieclip_anim_ibuf_for_frame_no_lock(struct MovieClip *clip,
+ struct MovieClipUser *user);
bool BKE_movieclip_has_cached_frame(struct MovieClip *clip, struct MovieClipUser *user);
bool BKE_movieclip_put_frame_if_possible(struct MovieClip *clip,