Fix T65651: Crash when changing audio strip source file

This commit is contained in:
Sergey Sharybin 2019-06-17 12:54:56 +02:00
parent 96e9caba6e
commit b50de0f8b7
Notes: blender-bot 2023-02-14 08:06:38 +01:00
Referenced by issue #65651, Crash when changing audio strip source file
6 changed files with 22 additions and 8 deletions

View File

@ -2456,7 +2456,9 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
SEQ_BEGIN (scene->ed, seq) {
if (seq->scene_sound == NULL) {
if (seq->sound != NULL) {
seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
if (seq->scene_sound == NULL) {
seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
}
}
else if (seq->type == SEQ_TYPE_SCENE) {
if (seq->scene != NULL) {
@ -2466,6 +2468,9 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
}
}
if (seq->scene_sound) {
if (scene->id.recalc & ID_RECALC_AUDIO || seq->sound->id.recalc & ID_RECALC_AUDIO) {
BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
}
BKE_sound_set_scene_sound_volume(
seq->scene_sound, seq->volume, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
BKE_sound_set_scene_sound_pitch(

View File

@ -1328,5 +1328,9 @@ void BKE_sound_jack_scene_update(Scene *scene, int mode, float time)
void BKE_sound_evaluate(Depsgraph *depsgraph, Main *bmain, bSound *sound)
{
DEG_debug_print_eval(depsgraph, __func__, sound->id.name, sound);
if (sound->id.recalc & ID_RECALC_AUDIO) {
BKE_sound_load(bmain, sound);
return;
}
BKE_sound_ensure_loaded(bmain, sound);
}

View File

@ -223,6 +223,7 @@ void depsgraph_tag_to_component_opcode(const ID *id,
case ID_RECALC_AUDIO_VOLUME:
case ID_RECALC_AUDIO_MUTE:
case ID_RECALC_AUDIO_LISTENER:
case ID_RECALC_AUDIO:
*component_type = NodeType::AUDIO;
break;
case ID_RECALC_ALL:
@ -656,6 +657,8 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag)
return "AUDIO_MUTE";
case ID_RECALC_AUDIO_LISTENER:
return "AUDIO_LISTENER";
case ID_RECALC_AUDIO:
return "AUDIO";
case ID_RECALC_ALL:
return "ALL";
}

View File

@ -612,6 +612,8 @@ typedef enum IDRecalcFlag {
ID_RECALC_AUDIO_MUTE = (1 << 18),
ID_RECALC_AUDIO_LISTENER = (1 << 19),
ID_RECALC_AUDIO = (1 << 20),
/***************************************************************************
* Pseudonyms, to have more semantic meaning in the actual code without
* using too much low-level and implementation specific tags. */

View File

@ -809,12 +809,9 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), Poin
rna_Sequence_invalidate_raw_update(bmain, scene, ptr);
}
static void rna_Sequence_sound_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
static void rna_Sequence_sound_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
Sequence *seq = (Sequence *)ptr->data;
if (seq->sound != NULL) {
BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
}
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO);
}
static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt)

View File

@ -32,9 +32,12 @@
# include "BKE_context.h"
# include "BKE_sequencer.h"
static void rna_Sound_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
# include "DEG_depsgraph.h"
static void rna_Sound_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
BKE_sound_load(bmain, (bSound *)ptr->data);
bSound *sound = (bSound *)ptr->data;
DEG_id_tag_update(&sound->id, ID_RECALC_AUDIO);
}
static bool rna_Sound_caching_get(PointerRNA *ptr)