Commit 4787c71d179ae9b67b0e682a2a95b6ceca4e68c4
1 parent
541e0844
debug fix (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1619 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
34 additions
and
31 deletions
audio/alsaaudio.c
... | ... | @@ -570,36 +570,39 @@ static int alsa_run_out (HWVoiceOut *hw) |
570 | 570 | |
571 | 571 | hw->clip (dst, src, convert_samples); |
572 | 572 | |
573 | - again: | |
574 | - written = snd_pcm_writei (alsa->handle, dst, convert_samples); | |
575 | - | |
576 | - if (written < 0) { | |
577 | - switch (written) { | |
578 | - case -EPIPE: | |
579 | - if (!alsa_recover (alsa->handle)) { | |
580 | - goto again; | |
581 | - } | |
582 | - dolog ( | |
583 | - "Failed to write %d frames to %p, handle %p not prepared\n", | |
584 | - convert_samples, | |
585 | - dst, | |
586 | - alsa->handle | |
587 | - ); | |
588 | - goto exit; | |
573 | + while (convert_samples) { | |
574 | + written = snd_pcm_writei (alsa->handle, dst, convert_samples); | |
589 | 575 | |
590 | - case -EAGAIN: | |
591 | - goto again; | |
576 | + if (written < 0) { | |
577 | + switch (written) { | |
578 | + case -EPIPE: | |
579 | + if (!alsa_recover (alsa->handle)) { | |
580 | + continue; | |
581 | + } | |
582 | + dolog ("Failed to write %d frames to %p, " | |
583 | + "handle %p not prepared\n", | |
584 | + convert_samples, | |
585 | + dst, | |
586 | + alsa->handle); | |
587 | + goto exit; | |
592 | 588 | |
593 | - default: | |
594 | - alsa_logerr (written, "Failed to write %d frames to %p\n", | |
595 | - convert_samples, dst); | |
596 | - goto exit; | |
589 | + case -EAGAIN: | |
590 | + continue; | |
591 | + | |
592 | + default: | |
593 | + alsa_logerr (written, "Failed to write %d frames to %p\n", | |
594 | + convert_samples, dst); | |
595 | + goto exit; | |
596 | + } | |
597 | 597 | } |
598 | - } | |
599 | 598 | |
600 | - mixeng_clear (src, written); | |
601 | - rpos = (rpos + written) % hw->samples; | |
602 | - samples -= written; | |
599 | + mixeng_clear (src, written); | |
600 | + rpos = (rpos + written) % hw->samples; | |
601 | + samples -= written; | |
602 | + convert_samples -= written; | |
603 | + dst = advance (dst, written << hw->info.shift); | |
604 | + src += written; | |
605 | + } | |
603 | 606 | } |
604 | 607 | |
605 | 608 | exit: |
... | ... | @@ -661,8 +664,8 @@ static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) |
661 | 664 | |
662 | 665 | alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift); |
663 | 666 | if (!alsa->pcm_buf) { |
664 | - dolog ("Could not allocate DAC buffer (%d bytes)\n", | |
665 | - hw->samples << hw->info.shift); | |
667 | + dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n", | |
668 | + hw->samples, 1 << hw->info.shift); | |
666 | 669 | alsa_anal_close (&handle); |
667 | 670 | return -1; |
668 | 671 | } |
... | ... | @@ -751,8 +754,8 @@ static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as) |
751 | 754 | |
752 | 755 | alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); |
753 | 756 | if (!alsa->pcm_buf) { |
754 | - dolog ("Could not allocate ADC buffer (%d bytes)\n", | |
755 | - hw->samples << hw->info.shift); | |
757 | + dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n", | |
758 | + hw->samples, 1 << hw->info.shift); | |
756 | 759 | alsa_anal_close (&handle); |
757 | 760 | return -1; |
758 | 761 | } | ... | ... |
audio/audio_int.h
... | ... | @@ -216,7 +216,7 @@ static inline int audio_need_to_swap_endian (int endianness) |
216 | 216 | #if defined __GNUC__ |
217 | 217 | #define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2))) |
218 | 218 | #define INIT_FIELD(f) . f |
219 | -#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (printf, n, m))) | |
219 | +#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m))) | |
220 | 220 | #else |
221 | 221 | #define GCC_ATTR /**/ |
222 | 222 | #define INIT_FIELD(f) /**/ | ... | ... |