Commit 6d971235 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

dsound: Fix calcplayposition to handle mixed amount > buffer length better.

parent 8b9454d4
...@@ -444,13 +444,11 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD p ...@@ -444,13 +444,11 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD p
TRACE("this back-offset=%d\n", pmix); TRACE("this back-offset=%d\n", pmix);
/* sanity */ /* sanity */
if(pmix > This->buflen){ if(pmix > This->buflen)
ERR("Bad length in CalcPlayPosition!\n"); WARN("Mixed length (%d) is longer then buffer length (%d)\n", pmix, This->buflen);
return 0;
}
/* subtract from our last mixed position */ /* subtract from our last mixed position */
if (bplay < pmix) bplay += This->buflen; /* wraparound */ while (bplay < pmix) bplay += This->buflen; /* wraparound */
bplay -= pmix; bplay -= pmix;
/* check for lead-in */ /* check for lead-in */
...@@ -461,9 +459,9 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD p ...@@ -461,9 +459,9 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD p
} }
/* sanity */ /* sanity */
if(bplay > This->buflen){ if (bplay >= This->buflen){
ERR("Bad play position in CalcPlayPosition!\n"); FIXME("Bad play position. bplay: %d, buflen: %d\n", bplay, This->buflen);
return 0; bplay %= This->buflen;
} }
/* return the result */ /* return the result */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment