quartz/dsoundrender: Several fixes.
This is a more correct version of 6849, plus some other changes not included in 6849, and should supersede the remaining patches in that merge request.
It is also a large and risky change and may not be suitable this close to code freeze.