[PATCH 1/4] mmdevapi: Enforce limits on period and duration.

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Fri Dec 16 04:16:49 CST 2011


Hi,

this patch stands on its own but needs to come before the others from bug #28723.

It'll make mmdevapi period & duration similar to native, in the absence of
buffer alignment requirements, as verified in testbot jobs # . Exceptions are:

- Not all errors the same as native in exclusive eventcallback mode, e.g.
Initialize(1,40000,800000,100000) failed: 88890013

- The 2s duration limit is artificial. MSDN mentions a 2s limit, however
  testbot shows that the limit depends on the period size.
Initialize(1,0,6666667,5000000) succeeds while
Initialize(1,0,6666667,30000) failed: 88890016
Initialize(1,0,6600000,0) failed: 88890016

Incidentally, this convinced me that winealsa should not be afraid
of using set_hw_params_*_min and bailing out as needed, e.g.
set_buffer_size_min(period_size)
if(err<0) AUDCLNT_E_INVALID_DEVICE_PERIOD

- The 3 x and 8 x period are observable
render.c:484: Initialize(1,0,6666667,5000000)
render.c:495: BufferSize 192000 estimated fragment 24000 x 1
 => a 4 second buffer!

Yet because of rounding issues there might be a need to apply
8x period_frames instead of 8x period_time so as to always compute
the same size as native. I've not checked that.
Native appears to use
MulDiv(bufsize_frames/period_frames), not
MulDiv(bufsize_time  /period_time).
The latter cannot explain all values of GetBufferSize.

Currently, Wine does not compute the same size as native.  A later
patch introducing MulDiv will improve that.  The present one simply shows
which values must serve as input to buffer and period size determination.

Regards,
	Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mmdevapi-Enforce-limits-on-period-and-duration.patch
Type: application/octet-stream
Size: 6337 bytes
Desc: 0001-mmdevapi-Enforce-limits-on-period-and-duration.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20111216/d64457ce/attachment.obj>


More information about the wine-patches mailing list