[libav-devel] [libva-devel] [PATCH] avformat/libsrt: add payload size and latency option / deprecate ts

Diego Biurrun diego at biurrun.de
Tue May 29 15:32:48 CEST 2018


> From 47e1d01b08494d5745d35f7a701059230c78671a Mon Sep 17 00:00:00 2001
> From: Nablet Developer <sdk at nablet.com>

Somebody still needs to set up their Git? :)

> Date: Mon, 21 May 2018 13:55:25 +0700
> Subject: [PATCH 1/2] avformat/libsrt: add payload size option
> 
> Signed-off-by: Nablet Developer <sdk at nablet.com>
> ---
>  doc/protocols.texi   | 10 ++++++++++
>  libavformat/libsrt.c | 19 ++++++++++++++++++-
>  2 files changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/protocols.texi b/doc/protocols.texi
> index e2d06a067..247734cd8 100644
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -755,6 +755,16 @@ only if @option{pbkeylen} is non-zero. It is used on
>  the receiver only if the received data is encrypted.
>  The configured passphrase cannot be recovered (write-only).
>  
> + at item payloadsize=@var{bytes}
> +Sets the maximum declared size of a single call to sending
> +function in Live mode.

Apart from - I think - a missing "the" in "to the sending" this sentence
confuses me. What is the size of a function call? Or is it something else
that size refers to?

> +Default value is for MPEG TS; if you are going to use SRT

MPEG-TS

> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -34,6 +34,16 @@
>  
> +/* This is for MPEG TS and it's a default SRTO_PAYLOADSIZE for SRTT_LIVE (8 TS packets) */

same

> +/* This is the maximum payload size for Live mode, should you have a different payload type than MPEG TS */

same

> @@ -86,6 +97,7 @@ static const AVOption libsrt_options[] = {
> +    { "payload size",   "maximum declared size of a single call to sending function",           OFFSET(payload_size),     AV_OPT_TYPE_INT,      { .i64 = SRT_LIVE_DEFAULT_PAYLOAD_SIZE }, -1, SRT_LIVE_MAX_PAYLOAD_SIZE, .flags = D|E },

see above

> @@ -276,7 +288,8 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
>          (s->nakreport >= 0 && libsrt_setsockopt(h, fd, SRTO_NAKREPORT, "SRTO_NAKREPORT", &s->nakreport, sizeof(s->nakreport)) < 0) ||
> -        (connect_timeout >= 0 && libsrt_setsockopt(h, fd, SRTO_CONNTIMEO, "SRTO_CONNTIMEO", &connect_timeout, sizeof(connect_timeout)) <0 )) {
> +        (connect_timeout >= 0 && libsrt_setsockopt(h, fd, SRTO_CONNTIMEO, "SRTO_CONNTIMEO", &connect_timeout, sizeof(connect_timeout)) <0 ) ||
> +        (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) <0 )) {

Add a space after '<' please.

> @@ -454,6 +467,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
>          }
> +	if (av_find_info_tag(buf, sizeof(buf), "payload_size", p)) {
> +	    s->payload_size = strtol(buf, NULL, 10);
> +	}

stray tabs

> @@ -466,6 +482,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
>              }
>          }
>      }
> +    h->max_packet_size = s->payload_size > 0 ? s->payload_size  :SRT_LIVE_DEFAULT_PAYLOAD_SIZE;

odd spacing around :

> From af93164c05eeb62c37c21cc7a9a3cd43c6c0c4a7 Mon Sep 17 00:00:00 2001
> From: Nablet Developer <sdk at nablet.com>

odd developer name

> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -710,6 +710,17 @@ IP Type of Service. Applies to sender only. Default value is 0xB8.
>  
> + at item latency
> +Timestamp-based Packet Delivery Delay.
> +Used to absorb burst of missed packet retransmission.

burstS, retransmissionS

> +This flag sets both @option{rcvlatency} and @option{peerlatency}
> +to the same value. Note that prior to version 1.3.0
> +this is the only flag to set the latency, however
> +this is effectively equivalent to setting @option{peerlatency},
> +when the side is sender and @option{rcvlatency}
> +when the side is receiver, and the bidirectional
> +stream sending is not supported.

"the side"?

> +
>  @item pbkeylen=@var{bytes}
>  Sender encryption key length, in bytes.
>  Only can be set to 0, 16, 24 and 32.
> @@ -773,6 +788,18 @@ Not required on receiver (set to 0),
>  key size obtained from sender in HaiCrypt handshake.
>  Default value is 0.
>  
> + at item rcvlatency
> +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.
> +This time should be a buffer time large enough to cover
> +the time spent for sending, unexpectedly extended RTT
> +time, and the time needed to retransmit the lost UDP
> +packet. The effective latency value will be the maximum
> +of this options' value and the value of @option{perrlatency}

pe_E_rlatency

> +set by the peer side. This option in pre-1.3.0 version
> +is available only as @option{latency}.

Before version 1.3.0 this option is only available as ..

> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -93,7 +95,9 @@ static const AVOption libsrt_options[] = {
>      { "oheadbw",        "MaxBW ceiling based on % over input stream rate",                      OFFSET(oheadbw),          AV_OPT_TYPE_INT,      { .i64 = -1 }, -1, 100,       .flags = D|E },
> -    { "tsbpddelay",     "TsbPd receiver delay to absorb burst of missed packet retransmission", OFFSET(tsbpddelay),       AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
> +    { "latency",        "TsbPd receiver delay to absorb burst of missed packet retransmission", OFFSET(latency),          AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },

tsbpd?

see above about missing plural 's'

Diego


More information about the libav-devel mailing list