Module: wine Branch: master Commit: 6d97123536f595a132765294080800400857948f URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d97123536f595a13276529408... Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com> Date: Fri Jun 29 18:30:52 2007 +0200 dsound: Fix calcplayposition to handle mixed amount > buffer length better. --- dlls/dsound/buffer.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index 96fb3d1..9de2a39 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -444,13 +444,11 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD p TRACE("this back-offset=%d\n", pmix); /* sanity */ - if(pmix > This->buflen){ - ERR("Bad length in CalcPlayPosition!\n"); - return 0; - } + if(pmix > This->buflen) + WARN("Mixed length (%d) is longer then buffer length (%d)\n", pmix, This->buflen); /* subtract from our last mixed position */ - if (bplay < pmix) bplay += This->buflen; /* wraparound */ + while (bplay < pmix) bplay += This->buflen; /* wraparound */ bplay -= pmix; /* check for lead-in */ @@ -461,9 +459,9 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD p } /* sanity */ - if(bplay > This->buflen){ - ERR("Bad play position in CalcPlayPosition!\n"); - return 0; + if (bplay >= This->buflen){ + FIXME("Bad play position. bplay: %d, buflen: %d\n", bplay, This->buflen); + bplay %= This->buflen; } /* return the result */