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

pkv pkv at obsproject.com
Wed Apr 8 03:16:23 EEST 2020


Hi

Le 08/04/2020 à 12:33 am, Limin Wang a écrit :
> On Tue, Apr 07, 2020 at 08:25:44PM +0200, pkv wrote:
>> Hi
>>
>> new patch for latency option following the comments from N. George.
> I recall I had submit a patchset for related option incliding latency.
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200331140808.8839-2-lance.lmwang@gmail.com/

hadn't spotted it; why was it not merged ?


>
> Why I haven't change to use AV_OPT_TYPE_DURATION, for the latency can
> be used in format srt://xxxx:port?latency=?, it's in unit of ms,
> in addition, AV_OPT_TYPE_DURATION is in unit of second default, it'll
> break the old user.
i tested with ffmpeg.exe; the change to

AV_OPT_TYPE_DURATION

didn't seem to break anything.

The default is still set to whatever the libsrt API has set (120 ms for 
transtype=live).

Can you produce code broken by that change ?

Regards


>
>> =====
>>
>> 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}
>> +Timestamp-based Packet Delivery Delay in microseconds.
>>   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}
>>   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 },
>> -- 
>> 2.24.1.windows.2
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list