• Luca Barbato's avatar
    lavf: improve handling of sparse streams when muxing · d9ae1031
    Luca Barbato authored
    
    
    Currently ff_interleave_packet_per_dts() waits until it gets a frame for
    each stream before outputting packets in interleaved order.
    
    Sparse streams (i.e. streams with much fewer packets than the other
    streams, like subtitles or audio with DTX) tend to add up latency and in
    specific cases end up allocating a large amount of memory.
    
    Emit the top packet from the packet_buffer if it has a time delta
    larger than a specified threshold.
    
    Original report of the issue and initial proposed solution by
    mus.svz@gmail.com.
    
    Bug-id: 31
    Signed-off-by: default avatarAnton Khirnov <anton@khirnov.net>
    d9ae1031