Skip to contentSkip to conversation

[4296] Audio endianness and mutex usage fixes (malc.git).

Qemu-devel Andrzej Zaborowski 1 participant 1 message May 2, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4296

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4296
Author:   balrog
Date:     2008-05-02 02:24:55 +0000 (Fri, 02 May 2008)

Log Message:
-----------
Audio endianness and mutex usage fixes (malc.git).

Quoted 1 line

From http://repo.or.cz/w/qemu/malc.git?a=shortlog;h=refs/heads/audio :

Implicitly lock the mutex at startup of playback/capture threads, otherwise pthread_mutex_destroy (in audio_pt_fini) fails with EBUSY. Endianness fix.
Remove a c&p residue.

Modified Paths:
--------------
trunk/audio/esdaudio.c

Modified: trunk/audio/esdaudio.c
===================================================================

audio/esdaudio.c +10 -5
@@ -84,6 +84,10 @@
 
     threshold = conf.divisor ? hw->samples / conf.divisor : 0;
 
+    if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) {
+        return NULL;
+    }
+
     for (;;) {
         int decr, to_mix, rpos;
 
@@ -215,13 +219,10 @@
 
     default:
         dolog ("Internal logic error: Bad audio format %d\n", as->fmt);
-#ifdef DEBUG_FMOD
-        abort ();
-#endif
         goto deffmt;
 
     }
-    obt_as.endianness = 0;
+    obt_as.endianness = AUDIO_HOST_ENDIANNESS;
 
     audio_pcm_init_info (&hw->info, &obt_as);
 
@@ -315,6 +316,10 @@
 
     threshold = conf.divisor ? hw->samples / conf.divisor : 0;
 
+    if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) {
+        return NULL;
+    }
+
     for (;;) {
         int incr, to_grab, wpos;
 
@@ -447,7 +452,7 @@
         obt_as.fmt = AUD_FMT_S16;
         break;
     }
-    obt_as.endianness = 0;
+    obt_as.endianness = AUDIO_HOST_ENDIANNESS;
 
     audio_pcm_init_info (&hw->info, &obt_as);