Commit 8f46a511 authored by Chris Robinson's avatar Chris Robinson Committed by Alexandre Julliard

winemp3: Don't keep unused data buffered.

parent 64683549
...@@ -48,7 +48,7 @@ BOOL InitMP3(struct mpstr *mp) ...@@ -48,7 +48,7 @@ BOOL InitMP3(struct mpstr *mp)
return !0; return !0;
} }
void ExitMP3(struct mpstr *mp) void ClearMP3Buffer(struct mpstr *mp)
{ {
struct buf *b,*bn; struct buf *b,*bn;
...@@ -59,6 +59,9 @@ void ExitMP3(struct mpstr *mp) ...@@ -59,6 +59,9 @@ void ExitMP3(struct mpstr *mp)
free(b); free(b);
b = bn; b = bn;
} }
mp->tail = NULL;
mp->head = NULL;
mp->bsize = 0;
} }
static struct buf *addbuf(struct mpstr *mp,const unsigned char *buf,int size) static struct buf *addbuf(struct mpstr *mp,const unsigned char *buf,int size)
......
...@@ -163,6 +163,9 @@ static void mp3_horse(PACMDRVSTREAMINSTANCE adsi, ...@@ -163,6 +163,9 @@ static void mp3_horse(PACMDRVSTREAMINSTANCE adsi,
buffered_after = get_num_buffered_bytes(&amd->mp); 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); 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) ...@@ -376,7 +379,7 @@ static LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
*/ */
static void MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi, AcmMpeg3Data* aad) static void MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi, AcmMpeg3Data* aad)
{ {
ExitMP3(&aad->mp); ClearMP3Buffer(&aad->mp);
InitMP3(&aad->mp); InitMP3(&aad->mp);
} }
...@@ -438,7 +441,7 @@ static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi) ...@@ -438,7 +441,7 @@ static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
*/ */
static LRESULT MPEG3_StreamClose(PACMDRVSTREAMINSTANCE adsi) static LRESULT MPEG3_StreamClose(PACMDRVSTREAMINSTANCE adsi)
{ {
ExitMP3(&((AcmMpeg3Data*)adsi->dwDriver)->mp); ClearMP3Buffer(&((AcmMpeg3Data*)adsi->dwDriver)->mp);
HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver); HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }
......
...@@ -62,7 +62,7 @@ extern "C" { ...@@ -62,7 +62,7 @@ extern "C" {
BOOL InitMP3(struct mpstr *mp); BOOL InitMP3(struct mpstr *mp);
int decodeMP3(struct mpstr *mp,const unsigned char *inmemory,int inmemsize, int decodeMP3(struct mpstr *mp,const unsigned char *inmemory,int inmemsize,
unsigned char *outmemory,int outmemsize,int *done); unsigned char *outmemory,int outmemsize,int *done);
void ExitMP3(struct mpstr *mp); void ClearMP3Buffer(struct mpstr *mp);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
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