[Scummvm-devel] Memory requirements of the SmushPlayer

Max Horn max at quendi.de
Thu Jun 22 10:00:02 CEST 2006


Nobody seems to have answered this one, so I'll try to do that now...


Am 17.06.2006 um 19:10 schrieb Lars Persson:

> Hi! I have struggeling to get Full Throttle working on my phone and  
> its
> really a struggle against memory requirements. So I have a small  
> question
> which someone of you might be able to answer.
>
> When creating an audiostream channel within smush a constant of  
> 500000 bytes
> is used for each smush audio channels with this line of code
> _channels[i].stream = Audio::makeAppendableAudioStream(rate, flags,  
> 500000);
>
> Where does this constant of 500000 come from!?

 From experiments, mostly. I think it was raised just recently  
(though I might be mixing it up with the size of another appendable  
audio stream in iMuseDigital or for IACT SMUSH audio) after we had a  
bug report about stuttering speech issues (which were caused by an  
audio buffer overflow).


> Since we are supporting 16 channels, this can become up to 8mb, so  
> lowering
> this value could really help me, if its possible.

You could try to do that, but essentially a full test of all affected  
games (including localized versions) would be required to verify  
nothing broke.

IMO, the better solution would be to either replace  
AppenableAudioStream with an implementation that scales better (maybe  
by using a chain of multiple buffers, or so, but be wary of slow  
malloc implementations). Or, even better, remove usage of it  
altogether (won't be an easy job, though).


> Another problem I am seeing is that reoccuring allocations is really
> fragmenting my memory heap, making later allocations even more  
> possible.
> Anyone thinking about trying to reuse memorypools, in like smush,  
> if its
> likely that the same amount of memory will be used in next frame?

The stream is not recreated every frame. It's only created once when  
a new channel starts playing, and deleted when a channel stops playing.
It might be possible to reuse the appendable audio stream more,  
though, feel free to give it a try (maybe somebody with some  
experience with that code is willing to help, too -- I certainly  
would, if I had any spare time left, which I don't  :-/)

Cheers,
Max





More information about the Scummvm-devel mailing list