Page MenuHome

Fix T69924: Prefetch stops when moving playhead
ClosedPublic

Authored by Richard Antalik (ISS) on Sep 26 2019, 1:04 AM.

Diff Detail

Repository
rB Blender
Branch
T70194 (branched from master)
Build Status
Buildable 5119
Build 5119: arc lint + arc unit

Event Timeline

  • Upon further reading, I realized, that pointer actually wasn't uninitialized, but I am still changing this line to avoid confusion.
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Sep 26 2019, 1:11 AM
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Sep 27 2019, 1:45 AM
source/blender/blenkernel/intern/seqprefetch.c
348

Do you know where exactly it needs to access the prefetch job from scene_eval?

It would be cleaner if we could avoid the need for that entirely.

  • Fix prefetching range (forgot in initial prefetch commit)
Richard Antalik (ISS) marked an inline comment as done.Sep 27 2019, 3:23 AM
Richard Antalik (ISS) added inline comments.
source/blender/blenkernel/intern/seqprefetch.c
348

For example in BKE_sequencer_cache_put()

When called form prefetch thread, context will refer to bmain_eval, scene_eval and even sequence will be copy of original.
These values are used to calculate hash for lookup, but we need to display them in main thread with different context.

so we swap thos values by

if (context->is_prefetch_render) {
  context = BKE_sequencer_prefetch_get_original_context(context);
  scene = context->scene;
  seq = BKE_sequencer_prefetch_get_original_sequence(seq, scene);
}

scene = context->scene; is equivalent to scene = scene_eval->ed->prefetch_job->context->scene

cache calls are quite deep, numerous and spread across the code, so now this seems to be the cleanest solution to me

Testing the latest diff:

The prefetch stop when moving playhead is now fixed.

The main problem is when prefetching isn't fast enough(on my computer) to avoid the playhead catching up, which makes the video freeze, while the audio keeps playing for a while even after stopping it. (A faster decodeable codec like DNxHD(for proxies) might solve this, and of course making sure that there is not mismatch between footage resolution and render resolution, switching Show Cache Off, and set Blendmode as Cross)

When looping a range which is longer than the cache area, the prefetch cache should continue at the beginning(which it doesn't now)(gif):

Playing Reverse outside the cached area, will make Blender freeze/unresponsive.

Maybe it could be considered to keep a bit of cached frames before the playhead for the often used toggle Reverse/Forward Play operation for finding the right frame to cut?

Richard Antalik (ISS) marked an inline comment as done.Sep 27 2019, 10:19 AM

The main problem is when prefetching isn't fast enough(on my computer) to avoid the playhead catching up, which makes the video freeze, while the audio keeps playing for a while even after stopping it.

Sure I thinh both issues are reported, I wont be mixing that here.

When looping a range which is longer than the cache area, the prefetch cache should continue at the beginning(which it doesn't now)(gif):


Playing Reverse outside the cached area, will make Blender freeze/unresponsive.

This I should look into here

Maybe it could be considered to keep a bit of cached frames before the playhead for the often used toggle Reverse/Forward Play operation for finding the right frame to cut?

Yeah I was thinking, this feature will be missing...

but let's keep discussion here on topic.

  • Upon further reading, I realized, that pointer actually wasn't uninitialized, but I am still changing this line to avoid confusion.
  • initialize depsgraph in isolated bmain struct
  • Fix prefetching range (forgot in initial prefetch commit)
  • Fix crash - Add check if prefetch job is initialized and running.
This revision is now accepted and ready to land.Oct 1 2019, 7:25 PM