[FFmpeg-devel] [PATCH 3/4] avformat: make flush_packets a tri-state and set it to -1 (auto) by default
Michael Niedermayer
michael at niedermayer.cc
Mon Jun 19 18:21:55 EEST 2017
On Mon, Jun 19, 2017 at 12:02:53AM +0200, Marton Balint wrote:
> If flushing is not disabled, then mux.c will signal the end of the packets with
> an AVIO_DATA_MARKER_FLUSH_POINT, and aviobuf will be able to decide to flush or
> not based on the preferred minimum packet size set by the used protocol.
>
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
> doc/formats.texi | 7 ++++---
> libavformat/mux.c | 12 +++++++++---
> libavformat/options_table.h | 4 ++--
> 3 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/doc/formats.texi b/doc/formats.texi
> index c51d4086db..ddd7743548 100644
> --- a/doc/formats.texi
> +++ b/doc/formats.texi
> @@ -182,9 +182,10 @@ Default is 0.
> Correct single timestamp overflows if set to 1. Default is 1.
>
> @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.
> +Flush the underlying I/O stream after each packet. Default is -1 (auto), which
> +means that the underlying protocol will decide, 1 enables it, and has the
> +effect of reducing the latency, 0 disables it and may increase IO throughput in
> +some cases.
>
> @item output_ts_offset @var{offset} (@emph{output})
> Set the output time offset.
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index e1e49a81be..7c97b77881 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -479,8 +479,10 @@ static int write_header_internal(AVFormatContext *s)
> s->internal->write_header_ret = ret;
> if (ret < 0)
> return ret;
> - if (s->flush_packets && s->pb && s->pb->error >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
> + if ((s->flush_packets == 1 || s->flags & AVFMT_FLAG_FLUSH_PACKETS) && s->pb && s->pb->error >= 0)
> avio_flush(s->pb);
> + if (s->flush_packets && !(s->oformat->flags & AVFMT_NOFILE) && s->pb && s->pb->error >= 0)
> + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT);
[...]
> if (s->pb && ret >= 0) {
> - if (s->flush_packets && s->flags & AVFMT_FLAG_FLUSH_PACKETS)
> + if (s->flush_packets == 1 || s->flags & AVFMT_FLAG_FLUSH_PACKETS)
> avio_flush(s->pb);
> + if (s->flush_packets && !(s->oformat->flags & AVFMT_NOFILE))
> + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT);
are these inteded to be if() instead of else if() ?
Either way iam in favor of this patch
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170619/d343e5a6/attachment.sig>
More information about the ffmpeg-devel
mailing list