Fix T94768: Crash in VSE prefetching

If timeline contains scene strip outside of edited meta strip, this will
cause crash. This is because prefetchin ignored meta strips being edited
when rendering, but did check for scene strips only inside edited meta
strip.

Change active seqbase pointer when entering meta strip. This makes it
possible to prefetch only content that is being presented to user.
This commit is contained in:
Richard Antalik 2022-01-11 06:12:15 +01:00
parent f134341e03
commit f2fb9a0c59
Notes: blender-bot 2023-02-14 09:38:57 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #94768, Video Sequencer Preview with Prefetch Frames crashes inside Meta Strip
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
2 changed files with 18 additions and 1 deletions

View File

@ -1950,6 +1950,8 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Editing *ed = SEQ_editing_get(scene);
Sequence *active_seq = SEQ_select_active_get(scene);
SEQ_prefetch_stop(scene);
if (active_seq && active_seq->type == SEQ_TYPE_META && active_seq->flag & SELECT) {
/* Enter meta-strip. */
SEQ_meta_stack_alloc(ed, active_seq);

View File

@ -328,6 +328,20 @@ static void seq_prefetch_update_scene(Scene *scene)
seq_prefetch_init_depsgraph(pfjob);
}
static void seq_prefetch_update_active_seqbase(PrefetchJob *pfjob)
{
MetaStack *ms_orig = SEQ_meta_stack_active_get(SEQ_editing_get(pfjob->scene));
Editing *ed_eval = SEQ_editing_get(pfjob->scene_eval);
if (ms_orig != NULL) {
Sequence *meta_eval = seq_prefetch_get_original_sequence(ms_orig->parseq, pfjob->scene_eval);
SEQ_seqbase_active_set(ed_eval, &meta_eval->seqbase);
}
else {
SEQ_seqbase_active_set(ed_eval, &ed_eval->seqbase);
}
}
static void seq_prefetch_resume(Scene *scene)
{
PrefetchJob *pfjob = seq_prefetch_job_get(scene);
@ -486,7 +500,7 @@ static void *seq_prefetch_frames(void *job)
*/
pfjob->scene_eval->ed->prefetch_job = pfjob;
ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(pfjob->scene));
ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(pfjob->scene_eval));
if (seq_prefetch_must_skip_frame(pfjob, seqbase)) {
pfjob->num_frames_prefetched++;
continue;
@ -549,6 +563,7 @@ static PrefetchJob *seq_prefetch_start_ex(const SeqRenderData *context, float cf
seq_prefetch_update_scene(context->scene);
seq_prefetch_update_context(context);
seq_prefetch_update_active_seqbase(pfjob);
BLI_threadpool_remove(&pfjob->threads, pfjob);
BLI_threadpool_insert(&pfjob->threads, pfjob);