Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/intern/sound.c15
-rw-r--r--source/blender/blenloader/intern/readfile.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c15
-rw-r--r--source/blender/editors/space_sequencer/sequencer_preview.c4
-rw-r--r--source/blender/makesdna/DNA_sound_types.h4
5 files changed, 25 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 43daaf2120c..25ac3c91b7f 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -118,9 +118,10 @@ void BKE_sound_free(bSound *sound)
sound_free_waveform(sound);
- if (sound->mutex) {
- BLI_mutex_free(sound->mutex);
- sound->mutex = NULL;
+ if (sound->spinlock) {
+ BLI_spin_end(sound->spinlock);
+ MEM_freeN(sound->spinlock);
+ sound->spinlock = NULL;
}
#endif /* WITH_AUDASPACE */
@@ -709,18 +710,18 @@ void sound_read_waveform(bSound *sound, short *stop)
MEM_freeN(waveform->data);
}
MEM_freeN(waveform);
- BLI_mutex_lock(sound->mutex);
+ BLI_spin_lock(sound->spinlock);
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
return;
}
sound_free_waveform(sound);
- BLI_mutex_lock(sound->mutex);
+ BLI_spin_lock(sound->spinlock);
sound->waveform = waveform;
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
}
void sound_update_scene(Main *bmain, struct Scene *scene)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 34ad6d3ea61..9daa6931282 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6872,9 +6872,10 @@ static void direct_link_sound(FileData *fd, bSound *sound)
sound->waveform = NULL;
}
- if (sound->mutex)
- sound->mutex = BLI_mutex_alloc();
-
+ if (sound->spinlock) {
+ sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
+ BLI_spin_init(sound->spinlock);
+ }
/* clear waveform loading flag */
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 6d7e4ad1d8d..3be6cd79504 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -70,6 +70,7 @@
#include "WM_api.h"
+#include "MEM_guardedalloc.h"
/* own include */
#include "sequencer_intern.h"
@@ -200,23 +201,25 @@ static void drawseqwave(const bContext *C, SpaceSeq *sseq, Scene *scene, Sequenc
SoundWaveform *waveform;
- if (!sound->mutex)
- sound->mutex = BLI_mutex_alloc();
+ if (!sound->spinlock) {
+ sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
+ BLI_spin_init(sound->spinlock);
+ }
- BLI_mutex_lock(sound->mutex);
+ BLI_spin_lock(sound->spinlock);
if (!seq->sound->waveform) {
if (!(sound->flags & SOUND_FLAGS_WAVEFORM_LOADING)) {
/* prevent sounds from reloading */
seq->sound->flags |= SOUND_FLAGS_WAVEFORM_LOADING;
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
sequencer_preview_add_sound(C, seq);
}
else {
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
}
return; /* nothing to draw */
}
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
waveform = seq->sound->waveform;
diff --git a/source/blender/editors/space_sequencer/sequencer_preview.c b/source/blender/editors/space_sequencer/sequencer_preview.c
index da00b0ff6e1..57c81e919e5 100644
--- a/source/blender/editors/space_sequencer/sequencer_preview.c
+++ b/source/blender/editors/space_sequencer/sequencer_preview.c
@@ -95,9 +95,9 @@ static void preview_startjob(void *data, short *stop, short *do_update, float *p
sound = previewjb->sound;
/* make sure we cleanup the loading flag! */
- BLI_mutex_lock(sound->mutex);
+ BLI_spin_lock(sound->spinlock);
sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING;
- BLI_mutex_unlock(sound->mutex);
+ BLI_spin_unlock(sound->spinlock);
BLI_mutex_lock(pj->mutex);
previewjb = previewjb->next;
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index 4ab22e4f7b7..cb132c1b550 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -95,8 +95,8 @@ typedef struct bSound {
*/
void *playback_handle;
- /* mutex for asynchronous loading of sounds */
- void *mutex;
+ /* spinlock for asynchronous loading of sounds */
+ void *spinlock;
/* XXX unused currently (SOUND_TYPE_LIMITER) */
/* float start, end; */
} bSound;