xemu/audio
Wu Fengguang fd5723b385 pulse-audio: fix bug on updating rpos
Fix a rpos coordination bug between qpa_run_out() and qpa_thread_out(),
which shows up as playback noises.

	qpa_run_out()
			qpa_thread_out loop N critical section 1
	qpa_run_out()   qpa_thread_out loop N doing pa_simple_write()
	qpa_run_out()	qpa_thread_out loop N doing pa_simple_write()
			qpa_thread_out loop N critical section 2
			qpa_thread_out loop N+1 critical section 1
	qpa_run_out()	qpa_thread_out loop N+1 doing pa_simple_write()

In the above scheme, "qpa_thread_out loop N+1 critical section 1" will
get the same rpos as the one used by "qpa_thread_out loop N critical
section 1". So it will be reading dead samples from the old rpos.

The rpos can only be updated back to qpa_thread_out when there is a
qpa_run_out() run between two qpa_thread_out loops.

normal sequence:
	qpa_thread_out:
			hw->rpos (X0) => local rpos => pa->rpos (X1)
	qpa_run_out:
			pa->rpos (X1) => hw->rpos (X1)
	qpa_thread_out:
			hw->rpos (X1) => local rpos => pa->rpos (X2)

buggy sequence:
	qpa_thread_out:
			hw->rpos (X0) => local rpos => pa->rpos (X1)
	qpa_thread_out:
			hw->rpos (X0) => local rpos => pa->rpos (X1')

Obviously qpa_run_out() shall be called at least once between any two
qpa_thread_out loops (after pa->rpos is set), in order for the new
qpa_thread_out loop to see the updated rpos.

Setting pa->live to 0 does the trick. The next loop will have to wait
for one qpa_run_out() invocation in order to get a non-zero pa->live
and proceed.

Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
2010-09-29 08:24:14 +04:00
..
alsaaudio.c audio/alsa: Avoid snd_pcm_format_t vs audfmt_e mixup 2010-04-21 15:40:23 +04:00
audio_int.h Move macros GCC_ATTR and GCC_FMT_ATTR to common header file 2010-09-22 20:15:11 +00:00
audio_pt_int.c audio: make audio_pt_init block all signals 2010-08-06 13:15:22 +04:00
audio_pt_int.h pthreads-based audio and miscellaneous audio clean-up (malc). 2008-01-14 04:24:29 +00:00
audio_template.h audio: Fix memory size for resampling buffer in DAC case 2010-09-28 08:56:59 +04:00
audio_win_int.c Windows Waveform Audio driver (no ADC support yet) 2009-10-10 01:18:24 +04:00
audio_win_int.h Windows Waveform Audio driver (no ADC support yet) 2009-10-10 01:18:24 +04:00
audio.c savevm: Add DeviceState param 2010-07-06 10:36:28 -05:00
audio.h audio: remove last remnants of _t 2009-10-15 02:40:17 +04:00
coreaudio.c audio: internal API change 2009-09-18 14:04:36 +04:00
dsound_template.h Fix NAME2/FIELD2 warnings 2009-01-22 22:09:55 +00:00
dsoundaudio.c Windows Waveform Audio driver (no ADC support yet) 2009-10-10 01:18:24 +04:00
esdaudio.c audio: make audio_pt_init block all signals 2010-08-06 13:15:22 +04:00
fmodaudio.c audio: internal API change 2009-09-18 14:04:36 +04:00
mixeng_template.h Make audio violate POSIX less 2008-12-03 22:48:44 +00:00
mixeng.c audio: fix comment 2010-03-11 18:28:44 +03:00
mixeng.h coreaudio: fix sloppy "posixification" by 1ea879e558 2009-09-18 14:04:36 +04:00
noaudio.c audio: internal API change 2009-09-18 14:04:36 +04:00
ossaudio.c Workaround for broken OSS_GETVERSION on FreeBSD, part two 2010-01-13 01:59:03 +03:00
paaudio.c pulse-audio: fix bug on updating rpos 2010-09-29 08:24:14 +04:00
rate_template.h Make audio violate POSIX less 2008-12-03 22:48:44 +00:00
sdlaudio.c audio/sdl: return on error 2010-08-07 20:04:24 +04:00
wavaudio.c audio: internal API change 2009-09-18 14:04:36 +04:00
wavcapture.c Remove any pretense that there can be more than one AudioState 2009-05-14 03:20:43 +04:00
winwaveaudio.c winwave: ADC support 2009-10-15 10:43:45 +04:00