Fix some synchronization issues. Improve audio job debug output
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 20 Jan 2013 21:15:36 +0000 (16:15 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sun, 20 Jan 2013 21:15:36 +0000 (16:15 -0500)
* src/media/sound.c (make_audio_job): Always initialie the mutex
since some sound backends are multi-threaded and will use the
mutex. Jack and AO are examples.

* src/media/sound.c (make_audio_job): Improve the job log message.

* src/media/sound.c (play-media-stream-synchronously): Improve
play log message to make clear this is synchronous play.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/media/sound.c

index 681b14c..0b1fdea 100644 (file)
@@ -408,8 +408,8 @@ make_audio_job(Lisp_Object stream, Lisp_Object device, Lisp_Object sentinel)
 
        aj->state = MTSTATE_UNKNOWN;
        aj->play_state = MTPSTATE_UNKNOWN;
-#ifdef EF_USE_ASYNEQ
        SXE_MUTEX_INIT(&aj->mtx);
+#ifdef EF_USE_ASYNEQ
        audio_job_queue(aj) = NULL;
 #endif
 
@@ -419,7 +419,9 @@ make_audio_job(Lisp_Object stream, Lisp_Object device, Lisp_Object sentinel)
        aj->buffer = NULL;
        aj->buffer_alloc_size = 0;
 
-       SOUND_DEBUG_AJ("created: 0x%lx\n", (long unsigned int)aj);
+       SOUND_DEBUG_AJ("created: 0x%lx stream 0x%lx device 0x%lx sentinel 0x%lx\n", 
+                      (long unsigned int)aj, (long unsigned int)stream,
+                       (long unsigned int)device, (long unsigned int) sentinel);
        return aj;
 }
 
@@ -542,7 +544,7 @@ the playback volume.
        aj->queue = NULL;
 #endif
 
-       SOUND_DEBUG_AJ("calling play meth\n");
+       SOUND_DEBUG_AJ("sync calling play meth\n");
        XAUDIO_DEVICE(device)->meths->play(aj);
 
        if (!NILP(sentinel)) {