qemu-patch-raspberry4/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.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
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
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
coreaudio.c
dsound_template.h
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
mixeng.c audio: fix comment 2010-03-11 18:28:44 +03:00
mixeng.h
mixeng_template.h
noaudio.c
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
sdlaudio.c audio/sdl: return on error 2010-08-07 20:04:24 +04:00
wavaudio.c
wavcapture.c
winwaveaudio.c winwave: ADC support 2009-10-15 10:43:45 +04:00