debug fix (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1619 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
541e084426
commit
4787c71d17
@ -570,25 +570,24 @@ static int alsa_run_out (HWVoiceOut *hw)
|
|||||||
|
|
||||||
hw->clip (dst, src, convert_samples);
|
hw->clip (dst, src, convert_samples);
|
||||||
|
|
||||||
again:
|
while (convert_samples) {
|
||||||
written = snd_pcm_writei (alsa->handle, dst, convert_samples);
|
written = snd_pcm_writei (alsa->handle, dst, convert_samples);
|
||||||
|
|
||||||
if (written < 0) {
|
if (written < 0) {
|
||||||
switch (written) {
|
switch (written) {
|
||||||
case -EPIPE:
|
case -EPIPE:
|
||||||
if (!alsa_recover (alsa->handle)) {
|
if (!alsa_recover (alsa->handle)) {
|
||||||
goto again;
|
continue;
|
||||||
}
|
}
|
||||||
dolog (
|
dolog ("Failed to write %d frames to %p, "
|
||||||
"Failed to write %d frames to %p, handle %p not prepared\n",
|
"handle %p not prepared\n",
|
||||||
convert_samples,
|
convert_samples,
|
||||||
dst,
|
dst,
|
||||||
alsa->handle
|
alsa->handle);
|
||||||
);
|
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
case -EAGAIN:
|
case -EAGAIN:
|
||||||
goto again;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
alsa_logerr (written, "Failed to write %d frames to %p\n",
|
alsa_logerr (written, "Failed to write %d frames to %p\n",
|
||||||
@ -600,6 +599,10 @@ static int alsa_run_out (HWVoiceOut *hw)
|
|||||||
mixeng_clear (src, written);
|
mixeng_clear (src, written);
|
||||||
rpos = (rpos + written) % hw->samples;
|
rpos = (rpos + written) % hw->samples;
|
||||||
samples -= written;
|
samples -= written;
|
||||||
|
convert_samples -= written;
|
||||||
|
dst = advance (dst, written << hw->info.shift);
|
||||||
|
src += written;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
@ -661,8 +664,8 @@ static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as)
|
|||||||
|
|
||||||
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift);
|
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift);
|
||||||
if (!alsa->pcm_buf) {
|
if (!alsa->pcm_buf) {
|
||||||
dolog ("Could not allocate DAC buffer (%d bytes)\n",
|
dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n",
|
||||||
hw->samples << hw->info.shift);
|
hw->samples, 1 << hw->info.shift);
|
||||||
alsa_anal_close (&handle);
|
alsa_anal_close (&handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -751,8 +754,8 @@ static int alsa_init_in (HWVoiceIn *hw, audsettings_t *as)
|
|||||||
|
|
||||||
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
|
alsa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
|
||||||
if (!alsa->pcm_buf) {
|
if (!alsa->pcm_buf) {
|
||||||
dolog ("Could not allocate ADC buffer (%d bytes)\n",
|
dolog ("Could not allocate ADC buffer (%d samples, each %d bytes)\n",
|
||||||
hw->samples << hw->info.shift);
|
hw->samples, 1 << hw->info.shift);
|
||||||
alsa_anal_close (&handle);
|
alsa_anal_close (&handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ static inline int audio_need_to_swap_endian (int endianness)
|
|||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2)))
|
#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, 2)))
|
||||||
#define INIT_FIELD(f) . f
|
#define INIT_FIELD(f) . f
|
||||||
#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (printf, n, m)))
|
#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m)))
|
||||||
#else
|
#else
|
||||||
#define GCC_ATTR /**/
|
#define GCC_ATTR /**/
|
||||||
#define INIT_FIELD(f) /**/
|
#define INIT_FIELD(f) /**/
|
||||||
|
Loading…
Reference in New Issue
Block a user