[Bf-blender-cvs] [9cb1810551a] master: Fix T66431: SE - Audio Caching crash

Sergey Sharybin noreply at git.blender.org
Mon Jul 8 16:07:47 CEST 2019


Commit: 9cb1810551a257043f1f6db7e320b690ff4391f4
Author: Sergey Sharybin
Date:   Mon Jul 8 15:57:33 2019 +0200
Branches: master
https://developer.blender.org/rB9cb1810551a257043f1f6db7e320b690ff4391f4

Fix T66431: SE - Audio Caching crash

Moved the caching code from direct calls in DNA to dependency graph.

In fact, not much was needed to be done apart form removing the direct
cache updates. The rest seemed to work fine.

Possible to avoid full sound file re-load, but doesn't seem this is
causing any issues.

===================================================================

M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/blenkernel/intern/sound.c
M	source/blender/editors/sound/sound_ops.c
M	source/blender/makesrna/intern/rna_sound.c

===================================================================

diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index f2e0ee0c7fa..ceb06c29f09 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -5400,7 +5400,7 @@ static void seq_load_apply(Main *bmain, Scene *scene, Sequence *seq, SeqLoadInfo
 
     if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
       if (seq->sound) {
-        BKE_sound_cache(seq->sound);
+        seq->sound->flags |= SOUND_FLAGS_CACHING;
       }
     }
 
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 1722b888d28..6d782726e07 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -389,7 +389,6 @@ void BKE_sound_cache(bSound *sound)
 {
   sound_verify_evaluated_id(&sound->id);
 
-  sound->flags |= SOUND_FLAGS_CACHING;
   if (sound->cache) {
     AUD_Sound_free(sound->cache);
   }
@@ -405,7 +404,6 @@ void BKE_sound_cache(bSound *sound)
 
 void BKE_sound_delete_cache(bSound *sound)
 {
-  sound->flags &= ~SOUND_FLAGS_CACHING;
   if (sound->cache) {
     AUD_Sound_free(sound->cache);
     sound->cache = NULL;
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index f4191f87df6..0241a2fbe88 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -104,7 +104,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
   }
 
   if (RNA_boolean_get(op->ptr, "cache")) {
-    BKE_sound_cache(sound);
+    sound->flags |= SOUND_FLAGS_CACHING;
   }
 
   /* hook into UI */
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index e4b120261c6..8402c4a8705 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -40,26 +40,10 @@ static void rna_Sound_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
   DEG_id_tag_update(&sound->id, ID_RECALC_AUDIO);
 }
 
-static bool rna_Sound_caching_get(PointerRNA *ptr)
+static void rna_Sound_caching_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-  bSound *sound = (bSound *)(ptr->data);
-  return (sound->flags & SOUND_FLAGS_CACHING) != 0;
-}
-
-static void rna_Sound_caching_set(PointerRNA *ptr, const bool value)
-{
-  bSound *sound = (bSound *)(ptr->data);
-  if (value) {
-    BKE_sound_cache(sound);
-  }
-  else {
-    BKE_sound_delete_cache(sound);
-  }
-}
-
-static void rna_Sound_caching_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
-{
-  BKE_sequencer_update_sound(scene, (bSound *)(ptr->data));
+  rna_Sound_update(bmain, scene, ptr);
+  DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
 }
 
 #else
@@ -87,7 +71,7 @@ static void rna_def_sound(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Packed File", "");
 
   prop = RNA_def_property(srna, "use_memory_cache", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
+  RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_CACHING);
   RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM");
   RNA_def_property_update(prop, 0, "rna_Sound_caching_update");



More information about the Bf-blender-cvs mailing list