On Thu, Apr 28, 2011 at 02:23:59PM +0200, Luca Barbato wrote:
> On 4/28/11 1:19 PM, Clément Bœsch wrote:
> >The number of streams in the Ogg context is well set to 0 but not in the
> >a/v format context, so the number of stream is incremented in
> >av_new_stream and leads to a leak (and maybe worst). The attached patch
> >fix this.
>
> Could you please give us more context? I'm afraid that isn't enough
> if I understood correctly.
>
Sure. The best way to notice the issue is changing the modified line in
the patch with av_dump_format(s, 0, s->filename, 0) and you'll notice that
kind of stuff after a few track switches (if it's a continuous bitstream):
Stream #0.1: Invalid Codec type -1
Stream #0.2: Invalid Codec type -1
Stream #0.3: Invalid Codec type -1
Stream #0.4: Invalid Codec type -1
Stream #0.5: Invalid Codec type -1
Currently, setting ogg->nstreams to 0 will make ogg_new_stream reallocate
its streams entry, but it also calls av_new_stream (always with idx = 0)
which will increment the number of streams in the a/v format context, just
like ogg_new_stream. So it needs be reset to 0 too to behave in a similar
way.
Another patch would be to not increment the number of stream if the stream
is already allocated in av_new_stream, but I'm not sure of the
consequences…
--
Clément B.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel