winemp3: Don't keep unused data buffered.

This commit is contained in:
Chris Robinson 2008-02-20 05:14:07 -08:00 committed by Alexandre Julliard
parent 64683549b0
commit 8f46a51192
3 changed files with 10 additions and 4 deletions

View file

@ -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)

View file

@ -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;
}

View file

@ -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
}