https://bugs.winehq.org/show_bug.cgi?id=42546
--- Comment #8 from Ivan_83 rozhuk.im@gmail.com --- (In reply to Huw Davies from comment #7)
Actually, shouldn't new_buflen = frames * wfx->nChannels * sizeof(float) ?
I don't get what fraglen is doing, but this at least would make it match aclen (with the appropriate conversion to deal with the change of type).
I think not. nChannels never used in code. Buf size always in frames (but frames count some where include nChannels) and other weird (for me) things like aclen and fraglen.
To fix crash and prevent in future regression: device->buffer = newbuf; device->buflen = new_buflen; device->fraglen = frag_frames * wfx->nBlockAlign; device->aclen = aclen_frames * wfx->nBlockAlign; must be grouped into one place and calculated correctly.
I wrote: new_buflen = ((frames + 1) * wfx->nBlockAlign * sizeof(float)); just to get buf size is bugger than later set in device->fraglen, device->aclen. wfx->nBlockAlign - just to not wrote some magic constant like 128 to bee 100% that allocated mem is bigger that can be set as size some where later.
Stop playing around new_buflen in DSOUND_PrimaryOpen() and do it right once for long time.