Andrew,
The good news is that your underrun patch prevents mmdevapi from writing less and less frames in mmdevapi/tests/render:test_worst_case http://test.winehq.org/data/f0cfa7cf46d7c832fb84555529d1a1b7c49c46c0/mac_jch...
render.c:1631: Released 86436=98x882 -0 frames at 44100 worth 1960ms in 2035ms render.c:1631: Released 71442=81x882 -0 frames at 44100 worth 1620ms in 2037ms render.c:1631: Released 56448=64x882 -0 frames at 44100 worth 1280ms in 2039ms
That is abnormal behavior.
+ sc = AudioQueueEnqueueBufferWithParameters(This->aqueue, + This->public_buffer, 0, NULL, 0, 0, 0, NULL, &req_time, &start_time); I advise against setting req_time. This can only fragilize the system. What if req_time is miscomputed or there's a delay? NULL=ASAP is exactly what we want. We don't want ALSA/dmix behavior, where it'll silently skip over late frames in order to catch up (dunno if MacOSX does this but in my eyes that doesn't matter). If you need to memorize a time, I believe it's best stored in our AQBuffer struct.
if(list_count(...) == 0)
I once wrote a patch to turn such a pattern into if(list_empty(...))
Regards, Jörg