On Mon, 27 Feb 2012, Luca Barbato wrote:

On 2/26/12 10:53 PM, Martin Storsjö wrote:

I noticed that the matroska muxer hangs if switching the AVIOContext at
runtime (if not using the option I added) - I guess it's something that
can't be fixed (as in made to work) but could at least fail without
hanging - I'll look at that later if I'm bored. :-)

That's strange indeed.

Not that strange actually - it tries to finish some tag/block (what's it in matroska vocabulary?) and writes avio_tell(pb) - block.start_pos somewhere, but if changing AVIOContexts, the current position returned by avio_tell() is less than block.start_pos, and iirc something casts this into uint64_t, turning this into a very large number, leading something else into an infinite loop.

If we'd want to isolate the muxers from these kinds of things (if using the segmenter in the "no individual header/trailer" mode), instead of closing/reopning the AVIOContext, we could use a custom AVIOContext which just chains writes into separate files. (That also simplifies the "don't write the header/trailer at all" case.) Then the output from the muxer point of view looks like one long stream without wrapping values from avio_tell(). This actually is closer to what my own segmenter does.

I'll see if I can implement this, too :-)

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to