[FFmpeg-devel] [PATCH] lavf/nutenc: flush after each packets.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Mar 10 16:26:38 CET 2013


On Sun, Mar 10, 2013 at 03:34:39PM +0100, Nicolas George wrote:
> This reduces the latency.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavformat/nutenc.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
> index 2d8d265..0fbc4f9 100644
> --- a/libavformat/nutenc.c
> +++ b/libavformat/nutenc.c
> @@ -977,6 +977,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
>          nut->max_pts_tb = nus->time_base;
>      }
>  
> +    avio_flush(bc);
>      return 0;

I see we are doing this in a lot of encoders, but this seems just bad to
me.
While it reduces latency, it also reduces performance in some use-cases.
In addition, it is just silly code duplication to have this inside
(almost) every single muxer.
Extracting it in some way and possibly making it configurable seems
like it would be a good thing to do long-term.


More information about the ffmpeg-devel mailing list