Commit deb9d2eea7c385c9d19d15be9a7576cbfe9ed5a5

Authored by balrog
1 parent b0f6edb1

Audio endianness and mutex usage fixes (malc.git).

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.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4296 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 5 deletions
audio/esdaudio.c
... ... @@ -84,6 +84,10 @@ static void *qesd_thread_out (void *arg)
84 84  
85 85 threshold = conf.divisor ? hw->samples / conf.divisor : 0;
86 86  
  87 + if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) {
  88 + return NULL;
  89 + }
  90 +
87 91 for (;;) {
88 92 int decr, to_mix, rpos;
89 93  
... ... @@ -215,13 +219,10 @@ static int qesd_init_out (HWVoiceOut *hw, audsettings_t *as)
215 219  
216 220 default:
217 221 dolog ("Internal logic error: Bad audio format %d\n", as->fmt);
218   -#ifdef DEBUG_FMOD
219   - abort ();
220   -#endif
221 222 goto deffmt;
222 223  
223 224 }
224   - obt_as.endianness = 0;
  225 + obt_as.endianness = AUDIO_HOST_ENDIANNESS;
225 226  
226 227 audio_pcm_init_info (&hw->info, &obt_as);
227 228  
... ... @@ -315,6 +316,10 @@ static void *qesd_thread_in (void *arg)
315 316  
316 317 threshold = conf.divisor ? hw->samples / conf.divisor : 0;
317 318  
  319 + if (audio_pt_lock (&esd->pt, AUDIO_FUNC)) {
  320 + return NULL;
  321 + }
  322 +
318 323 for (;;) {
319 324 int incr, to_grab, wpos;
320 325  
... ... @@ -447,7 +452,7 @@ static int qesd_init_in (HWVoiceIn *hw, audsettings_t *as)
447 452 obt_as.fmt = AUD_FMT_S16;
448 453 break;
449 454 }
450   - obt_as.endianness = 0;
  455 + obt_as.endianness = AUDIO_HOST_ENDIANNESS;
451 456  
452 457 audio_pcm_init_info (&hw->info, &obt_as);
453 458  
... ...