[wdmaudiodev] IMiniportWaveRTStream::GetPosition 32-bit wraparound

  • From: Matt Gonzalez <matt@xxxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 06 Nov 2007 17:58:02 -0800

We have a problem with our Wave RT driver. I think I fixed it, but it appears that doing so requires me to violate the spec.

The problem is that audio playback starts to break up after about three quarters of an hour. In fact, it turns out that it breaks up at the point where a 32 bit integer would roll over. The device is playing back 48 kHz 8 channel 32-bit audio; doing the math means that a 32-bit integer would overflow at around 46.6 minutes. Running the audio clock faster by syncing to word clock causes the breakup to occur earlier proportionate to the increase in the audio clock.

My device does not support a map-able position register, so my driver instead relies on the GetPosition call. The documentation states "Positions are specified as byte offsets from the beginning of the cyclic buffer"; it does not say so explicitly, but the wording suggests that the position should be no greater than the size of the cyclic buffer, similar to the position register. However if I implement my driver such that it returns the position modulo the buffer size, I see the above problem.

If I change my driver to return a constantly increasing 64-bit position, everything seems to be fine. I was able to play for well over an hour with no problems.

So am I just misreading the specification?  Is my solution in fact correct?



WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx


Other related posts: