[FFmpeg-devel] [PATCH] avformat/libsrt: Change latency option to milliseconds

Nicolas George george at nsup.org
Tue Apr 7 21:32:03 EEST 2020


pkv (12020-04-07):
> new patch for latency option following the comments from N. George.

Thanks.

> 
> =====
> 
> Updated protocol doc for srt to specify the unit of various latency options.
> Furthermore the type of the latency options is changed to
> AV_OPT_TYPE_DURATION
> (following comment from N. George).
> 
> The microsecond unit has caused confusion for both FFmpeg and obs-studio
> users:
> - https://github.com/Haivision/srt/issues/1223
> 
> - https://obsproject.com/mantis/view.php?id=1617
> 
> =====
> 
> Regards
> 

> From 1dd49812553f44bc5f1ed60660a2365d6a036c97 Mon Sep 17 00:00:00 2001
> From: pkv <pkv at obsproject.com>
> Date: Tue, 7 Apr 2020 18:08:22 +0200
> Subject: [PATCH] avformat/libsrt: Document latency options unit
> 
> Updated protocol doc for srt to specify the unit of various latency options.
> Furthermore the type of the latency options is changed to AV_OPT_TYPE_DURATION
> (following comment from N. George).
> 
> The microsecond unit has caused confusion for both FFmpeg and obs-studio users:
> - https://github.com/Haivision/srt/issues/1223
> 
> - https://obsproject.com/mantis/view.php?id=1617
> ---
>  doc/protocols.texi   | 6 +++---
>  libavformat/libsrt.c | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/doc/protocols.texi b/doc/protocols.texi
> index e510019f2d..ebf9dec529 100644
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -1286,8 +1286,8 @@ IP Type of Service. Applies to sender only. Default value is 0xB8.
>  @item ipttl=@var{ttl}
>  IP Time To Live. Applies to sender only. Default value is 64.
>  
> - at item latency
> -Timestamp-based Packet Delivery Delay.

> + at item latency=@var{microseconds}

There's a = instead of a space.

> +Timestamp-based Packet Delivery Delay in microseconds.

IIRC, we already had a similar discussion. For the API, as an integer,
it's indeed microseconds, but from the user interface, durations are
expressed with units, and if the unit is omitted it's seconds.

Therefore, it would be better to say it's a duration, and link tho the
corresponding documentation:

@ref{time duration syntax,,the Time duration section in the
ffmpeg-utils(1) manual,ffmpeg-utils}

>  Used to absorb bursts of missed packet retransmissions.
>  This flag sets both @option{rcvlatency} and @option{peerlatency}
>  to the same value. Note that prior to version 1.3.0
> @@ -1389,7 +1389,7 @@ Not required on receiver (set to 0),
>  key size obtained from sender in HaiCrypt handshake.
>  Default value is 0.
>  
> - at item rcvlatency

> + at item rcvlatency at var{microseconds}

Missing space.

>  The time that should elapse since the moment when the
>  packet was sent and the moment when it's delivered to
>  the receiver application in the receiving function.
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index 2d6fc4b7e7..5c61f9e0d7 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -118,10 +118,10 @@ static const AVOption libsrt_options[] = {
>      { "iptos",          "IP Type of Service",                                                   OFFSET(iptos),            AV_OPT_TYPE_INT,      { .i64 = -1 }, -1, 255,       .flags = D|E },
>      { "inputbw",        "Estimated input stream rate",                                          OFFSET(inputbw),          AV_OPT_TYPE_INT64,    { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
>      { "oheadbw",        "MaxBW ceiling based on % over input stream rate",                      OFFSET(oheadbw),          AV_OPT_TYPE_INT,      { .i64 = -1 }, -1, 100,       .flags = D|E },
> -    { "latency",        "receiver delay to absorb bursts of missed packet retransmissions",     OFFSET(latency),          AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
> +    { "latency",        "receiver delay to absorb bursts of missed packet retransmissions",     OFFSET(latency),          AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
>      { "tsbpddelay",     "deprecated, same effect as latency option",                            OFFSET(latency),          AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
> -    { "rcvlatency",     "receive latency",                                                      OFFSET(rcvlatency),       AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
> -    { "peerlatency",    "peer latency",                                                         OFFSET(peerlatency),      AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
> +    { "rcvlatency",     "receive latency",                                                      OFFSET(rcvlatency),       AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
> +    { "peerlatency",    "peer latency",                                                         OFFSET(peerlatency),      AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
>      { "tlpktdrop",      "Enable receiver pkt drop",                                             OFFSET(tlpktdrop),        AV_OPT_TYPE_BOOL,     { .i64 = -1 }, -1, 1,         .flags = D|E },
>      { "nakreport",      "Enable receiver to send periodic NAK reports",                         OFFSET(nakreport),        AV_OPT_TYPE_BOOL,     { .i64 = -1 }, -1, 1,         .flags = D|E },
>      { "connect_timeout", "Connect timeout. Caller default: 3000, rendezvous (x 10)",            OFFSET(connect_timeout),  AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200407/3b8347ea/attachment.sig>


More information about the ffmpeg-devel mailing list