diff options
author | Jörg Müller <nexyon@gmail.com> | 2020-03-23 11:33:02 +0300 |
---|---|---|
committer | Jörg Müller <nexyon@gmail.com> | 2020-03-23 11:34:26 +0300 |
commit | 0710fb724beb38cf76e0e9bce2c2b310027bef29 (patch) | |
tree | a689fa6316d0dcff67edd685de288d05858fd2e9 | |
parent | 46c0da6e69c38973e5616bb0a0f7f2ff7b43d5fa (diff) |
Fix T72632: Blender crashes using Jack with AV Sync enabled (repeatable)
4 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 1298f25fcc4..af50e61eb2d 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -117,6 +117,9 @@ void BKE_sound_ensure_scene(struct Scene *scene); void BKE_sound_destroy_scene(struct Scene *scene); +void BKE_sound_lock_scene(struct Scene *scene); +void BKE_sound_unlock_scene(struct Scene *scene); + void BKE_sound_reset_scene_specs(struct Scene *scene); void BKE_sound_mute_scene(struct Scene *scene, int muted); diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 5aa445c2146..3bb95eaeff0 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -550,6 +550,16 @@ void BKE_sound_destroy_scene(Scene *scene) } } +void BKE_sound_lock_scene(struct Scene *scene) +{ + AUD_Device_lock(sound_device); +} + +void BKE_sound_unlock_scene(struct Scene *scene) +{ + AUD_Device_unlock(sound_device); +} + void BKE_sound_reset_scene_specs(Scene *scene) { sound_verify_evaluated_id(&scene->id); @@ -1151,6 +1161,12 @@ void BKE_sound_create_scene(Scene *UNUSED(scene)) void BKE_sound_destroy_scene(Scene *UNUSED(scene)) { } +void BKE_sound_lock_scene(Scene *UNUSED(scene)) +{ +} +void BKE_sound_unlock_scene(Scene *UNUSED(scene)) +{ +} void BKE_sound_reset_scene_specs(Scene *UNUSED(scene)) { } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc index 9f47402790c..36d0138f697 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc @@ -23,6 +23,8 @@ #include "intern/eval/deg_eval_runtime_backup_scene.h" +#include "BKE_sound.h" + #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" @@ -44,6 +46,8 @@ void SceneBackup::reset() void SceneBackup::init_from_scene(Scene *scene) { + BKE_sound_lock_scene(scene); + sound_scene = scene->sound_scene; playback_handle = scene->playback_handle; sound_scrub_handle = scene->sound_scrub_handle; @@ -76,6 +80,8 @@ void SceneBackup::restore_to_scene(Scene *scene) sequencer_backup.restore_to_scene(scene); + BKE_sound_unlock_scene(scene); + reset(); } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index fda0cb70c5b..b640fdb59c9 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -217,8 +217,10 @@ static void sound_jack_sync_callback(Main *bmain, int mode, float time) if (depsgraph == NULL) { continue; } + BKE_sound_lock_scene(scene); Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); BKE_sound_jack_scene_update(scene_eval, mode, time); + BKE_sound_unlock_scene(scene); } } |