http://bugs.winehq.org/show_bug.cgi?id=28517
--- Comment #25 from Jörg Höhle hoehle@users.sourceforge.net 2011-10-06 16:43:12 CDT ---
dmix not stopping
I'll correct: plug:dmix can stop and enter XRUN given an appropriate stop_threshold.
[#samples < period never start] Have you seen this happen?
Definitely, in both XRUN and free running modes. plug:dmix starts only once written the frame #period_size, one by one or en bloc. snd_pcm_start or set_start_threshold won't change anything.
plughw is different and starts as soon as the first sample is written.
one more try
Did you try out my render tests from bug #27937? It's not my newest, but still useful. In particular, you can change the sleep(350) to test underrun behaviour as well as change "default" to "pulse", "plug:dmix" or "plughw:0" in mmdevdrv.c. I can't apply your code yet because my ALSA machine is not sync'ed with git now.
TRACE("PCM state: %u\n", snd_pcm_state(This->pcm_handle));
This looks like left over from debugging. To make it useful, please add avail_frames and possibly padding.
Initialize: snd_pcm_hw_params_current after snd_pcm_hw_params
is superfluous, This->hw_params is up to date. ALSA does not behave like a OO factory.
MinimumPeriod = 100000
I'd make it smaller than DefaultPeriod, e.g. 5ms.
this call seems to be required to get an accurate snd_pcm_state
I observed the same requirement for snd_pcm_delay
Do you think you need snd_pcm_state(This->pcm_handle) == SND_PCM_STATE_XRUN My tests show this test is superseded by avail > alsa_size. I.e. after XRUN, avail is larger. Not cross-checked with PA.