What happens upon mmdevapi capture overrun on native?

Maarten Lankhorst m.b.lankhorst at gmail.com
Fri Mar 9 20:06:31 CST 2012

Hey Joerg,

Op 09-03-12 17:46, Joerg-Cyril.Hoehle at t-systems.com schreef:
> Hi,
> Maarten Lankhorst wrote in winepulse: Add pulseaudio driver, v9:
>> - Reworked capture logic to always capture, since that seems to be the case on windows,
>>  when stopped we simply drop whole packets, but keep firing the event.
> Does anybody know what precisely happens upon overrun during capture?
> A. mmdevapi fills the whole buffer once.  It keeps firing events and
>    sets the DISCONTINUITY flag upon the next CaptureClient_GetBuffer.
>    This is like mciwave's "record from 0 to 5000" command.
>    The client can read the oldest recorded samples.
> B. mmdevapi continuously overwrites the circular buffer.  It keeps
>    firing events and sets the DISCONTINUITY flag too.  The client gets
>    to see the newest recorded samples.  It's like your TV recorder's time
>    shift function that can only travel back by as much as the buffer holds.
> C. Other, e.g. mixing newest with older packets (current winealsa).
> In other words, what data does the dlls/mmdevapi/capture test see in:
> http://source.winehq.org/source/dlls/mmdevapi/tests/capture.c?v=wine-1.4-rc6#L305
> I think A makes sense but really I don't know.  The tests show a
> position jump by one period worth of frames when reading the next
> packet after an overrun.  That's not what I'd expect from behaviour A.
> But from behaviour B I'd expect a much larger position jump, as large
> as elapsed time.
I suspect B, the position jump makes sense in that case, because
if you compare it with rendering on underrun clock doesn't get
increased, so it makes sense on capture clock doesn't increase
as well, and the discontinuity simply signals that an underrun has
occurred that's at least a period long. The exact clock time
passed will not matter. mmdevapi doesn't measure that in
shared mode.

It's also the only way the discontinuity flag would make sense
and for the tests to pass, otherwise you would have set it on
the first newly captured buffer after you finished reading out
all old data.


More information about the wine-devel mailing list