[FFmpeg-devel] [PATCH] lavf/mux: add the flush_packets option.

Clément Bœsch ubitux at gmail.com
Tue Mar 12 17:20:08 CET 2013


On Tue, Mar 12, 2013 at 05:07:45PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  doc/ffmpeg-formats.texi     |    5 +++++
>  libavformat/avformat.h      |    7 +++++++
>  libavformat/mux.c           |    2 ++
>  libavformat/options_table.h |    1 +
>  4 files changed, 15 insertions(+)
> 
> 
> Reimar Döffinger wrote:
> > 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.
> 
> I believe the cases where the performance hit would be non-negligible are
> very particular; enough to make flushing the default behaviour.
> 
> > 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.
> 
> I believe you are right. New patch attached.
> 
> Regards,
> 
> -- 
>   Nicolas George
> 
> 
> diff --git a/doc/ffmpeg-formats.texi b/doc/ffmpeg-formats.texi
> index 30cf415..ea61725 100644
> --- a/doc/ffmpeg-formats.texi
> +++ b/doc/ffmpeg-formats.texi
> @@ -142,6 +142,11 @@ Use wallclock as timestamps.
>  @item avoid_negative_ts @var{integer} (@emph{output})
>  Shift timestamps to make them positive. 1 enables, 0 disables, default
>  of -1 enables when required by target format.
> +
> + at item flush_packets @var{integer} (@emph{output})
> +Flush the underlying I/O stream after each packet. Default 1 enables it, and
> +has the effect of reducing the latency; 0 disables it and may slightly
> +increase performance in some cases.
>  @end table
>  
>  @c man end FORMAT OPTIONS
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 0fc71aa..ce4b8af 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1217,6 +1217,13 @@ typedef struct AVFormatContext {
>       */
>      int seek2any;
>  
> +    /**
> +     * Flush the I/O context after each packet.
> +     * - encoding: Set by user via AVOPtions (NO direct access)

AVOptions

Also, you may add a FIXME about removing explicit flushing from many
muxers.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130312/fb153092/attachment.asc>


More information about the ffmpeg-devel mailing list