On 26-7-2012 8:25, RafaŽl Carrť wrote:
> Le 2012-07-26 14:08, Bertrik Sikken a ťcrit :
>> Stuff that still needs work:
>> * Memory allocation in the codec main is not fully consistent yet (probably
>> leaking some memory), so playing several files in sequence may not work
>
> What do you mean by leak?
> codec_free() is a void operation, all memory which is malloc() (or
> realloc()) is lost (until next file I hope).

Actually, I think I was wrong and the problem I was seeing has probably
little to do with memory allocation. I'm still seeing that playing two
particular files in sequence makes the second one skip because an error
was detected during opus_decode() of a specific packet.
Not completely sure yet what is happening there.

> Ideally we should go and replace malloc() by static buffers using worst
> case possibilities when possible.

The mallocs still being done, are done only at initialisation time,
there is no malloc/free during playback, so using malloc for these
is fine IMO. We can initialise the malloc subsystem (e.g. through
a call to codec_init()) for each file we play.
I think this should work and isn't so bad; conversion to static buffers
probably requires changes (e.g. in ogg and opus) that probably make it
harder to sync with upstream later.

>> * Stack usage is still quite high, I've seen about 10k for music and 36k
>> for speech on the clip zip, our stacks are currently 10kB by default.
>
> I'd guess some big buffers are allocated on stack (rather than usage
> being due to recursion)

Gregory Maxwell from opus was looking into this a bit and I think he
identified the largest stack users. I guess this will end up being
a change in opus itself.

>> * Applying global gain from the opus audio file is not implemented
>> (not sure if replaygain is working)
>
> Fixed (it's part of the codec, not related to replaygain although we
> might want to implement replaygain for e.g. vorbis too).