From 8f46a5119249562aceabff6d120948cbfacb6423 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 20 Feb 2008 05:14:07 -0800 Subject: [PATCH] winemp3: Don't keep unused data buffered. --- dlls/winemp3.acm/interface.c | 5 ++++- dlls/winemp3.acm/mpegl3.c | 7 +++++-- dlls/winemp3.acm/mpglib.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/winemp3.acm/interface.c b/dlls/winemp3.acm/interface.c index 336a4f801e9..6ed8562d1b3 100644 --- a/dlls/winemp3.acm/interface.c +++ b/dlls/winemp3.acm/interface.c @@ -48,7 +48,7 @@ BOOL InitMP3(struct mpstr *mp) return !0; } -void ExitMP3(struct mpstr *mp) +void ClearMP3Buffer(struct mpstr *mp) { struct buf *b,*bn; @@ -59,6 +59,9 @@ void ExitMP3(struct mpstr *mp) free(b); b = bn; } + mp->tail = NULL; + mp->head = NULL; + mp->bsize = 0; } static struct buf *addbuf(struct mpstr *mp,const unsigned char *buf,int size) diff --git a/dlls/winemp3.acm/mpegl3.c b/dlls/winemp3.acm/mpegl3.c index e960dbe4a2e..3d18c9e9c95 100644 --- a/dlls/winemp3.acm/mpegl3.c +++ b/dlls/winemp3.acm/mpegl3.c @@ -163,6 +163,9 @@ static void mp3_horse(PACMDRVSTREAMINSTANCE adsi, buffered_after = get_num_buffered_bytes(&amd->mp); TRACE("before %d put %d during %d after %d\n", buffered_before, *nsrc, buffered_during, buffered_after); + + *nsrc -= buffered_after; + ClearMP3Buffer(&amd->mp); } /*********************************************************************** @@ -376,7 +379,7 @@ static LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs) */ static void MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi, AcmMpeg3Data* aad) { - ExitMP3(&aad->mp); + ClearMP3Buffer(&aad->mp); InitMP3(&aad->mp); } @@ -438,7 +441,7 @@ static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi) */ static LRESULT MPEG3_StreamClose(PACMDRVSTREAMINSTANCE adsi) { - ExitMP3(&((AcmMpeg3Data*)adsi->dwDriver)->mp); + ClearMP3Buffer(&((AcmMpeg3Data*)adsi->dwDriver)->mp); HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver); return MMSYSERR_NOERROR; } diff --git a/dlls/winemp3.acm/mpglib.h b/dlls/winemp3.acm/mpglib.h index 4efe8aed1e8..865e781e71e 100644 --- a/dlls/winemp3.acm/mpglib.h +++ b/dlls/winemp3.acm/mpglib.h @@ -62,7 +62,7 @@ extern "C" { BOOL InitMP3(struct mpstr *mp); int decodeMP3(struct mpstr *mp,const unsigned char *inmemory,int inmemsize, unsigned char *outmemory,int outmemsize,int *done); -void ExitMP3(struct mpstr *mp); +void ClearMP3Buffer(struct mpstr *mp); #ifdef __cplusplus }