[Scummvm-cvs-logs] CVS: residual smush.cpp,1.66,1.67
Gregory Montoir
cyx at users.sourceforge.net
Sat Aug 13 16:44:09 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: residual driver.h,1.14,1.15 driver_gl.cpp,1.57,1.58 driver_gl.h,1.27,1.28 driver_tinygl.cpp,1.29,1.30 driver_tinygl.h,1.15,1.16 engine.cpp,1.89,1.90 lua.cpp,1.153,1.154
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v6he.cpp,2.164,2.165
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22235
Modified Files:
smush.cpp
Log Message:
fixed memory leak in smush player : appendable audio streams make a copy of the data ; so we can get rid of SoundMixer::FLAG_AUTOFREE and free the temporary vima buffer.
Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- smush.cpp 10 Aug 2005 08:33:45 -0000 1.66
+++ smush.cpp 13 Aug 2005 23:43:30 -0000 1.67
@@ -92,10 +92,6 @@
free(_externalBuffer);
_externalBuffer = NULL;
}
-
- _videoLooping = false;
- _videoFinished = true;
- _videoPause = true;
if (_videoLooping && _startPos != NULL) {
free(_startPos->tmpBuf);
free(_startPos);
@@ -106,14 +102,17 @@
_stream = NULL;
g_mixer->stopHandle(_soundHandle);
}
+ _videoLooping = false;
+ _videoFinished = true;
+ _videoPause = true;
_file.close();
}
void Smush::handleWave(const byte *src, uint32 size) {
- int16 *dst = new int16[size * _channels];
+ int16 *dst = (int16 *)malloc(size * _channels * 2);
decompressVima(src, dst, size * _channels * 2, smushDestTable);
- int flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE;
+ int flags = SoundMixer::FLAG_16BITS;
if (_channels == 2)
flags |= SoundMixer::FLAG_STEREO;
@@ -123,6 +122,7 @@
}
if (_stream)
_stream->append((byte *)dst, size * _channels * 2);
+ free(dst);
}
void Smush::handleFrame() {
@@ -285,7 +285,7 @@
if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL) {
printf("SMUSH Flags:");
for(int i = 0; i < 16; i++)
- printf(" %d", (flags & ((int)pow(2.0f, i))) != 0);
+ printf(" %d", (flags & (1 << i)) != 0);
printf("\n");
}
_videoLooping = SMUSH_LOOPMOVIE(flags);
- Previous message: [Scummvm-cvs-logs] CVS: residual driver.h,1.14,1.15 driver_gl.cpp,1.57,1.58 driver_gl.h,1.27,1.28 driver_tinygl.cpp,1.29,1.30 driver_tinygl.h,1.15,1.16 engine.cpp,1.89,1.90 lua.cpp,1.153,1.154
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm script_v6he.cpp,2.164,2.165
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list