[FFmpeg-devel] avformat/libsrt: Change latency option to milliseconds
pkv
pkv at obsproject.com
Tue Apr 7 19:21:43 EEST 2020
Hi,
The latency option (and related options) are currently in microseconds
in FFmpeg (avformat/libsrt.c).
The libsrt API documents them in milliseconds while FFmpeg doc does not
specify any unit.
This patch changes these options to milliseconds and updates the FFmpeg doc.
The microsecond implicit 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
pkv
-------------- next part --------------
From 02a3000b91b81aa0c68ea1c01c2f88c8a4f3c754 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: Change latency option to milliseconds
The latency option (and related options) are currently in microseconds.
The libsrt API documents them in milliseconds while FFmpeg doc does not
specify anything.
This patch changes these options to milliseconds and updates the FFmpeg doc.
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 | 2 +-
libavformat/libsrt.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/protocols.texi b/doc/protocols.texi
index e510019f2d..b0e018b1ea 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1287,7 +1287,7 @@ IP Type of Service. Applies to sender only. Default value is 0xB8.
IP Time To Live. Applies to sender only. Default value is 64.
@item latency
-Timestamp-based Packet Delivery Delay.
+Timestamp-based Packet Delivery Delay in msec.
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
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 2d6fc4b7e7..b4a4e94d45 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -302,9 +302,9 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
{
SRTContext *s = h->priv_data;
int yes = 1;
- int latency = s->latency / 1000;
- int rcvlatency = s->rcvlatency / 1000;
- int peerlatency = s->peerlatency / 1000;
+ int64_t latency = s->latency;
+ int64_t rcvlatency = s->rcvlatency;
+ int64_t peerlatency = s->peerlatency;
int connect_timeout = s->connect_timeout;
if ((s->mode == SRT_MODE_RENDEZVOUS && libsrt_setsockopt(h, fd, SRTO_RENDEZVOUS, "SRTO_RENDEZVOUS", &yes, sizeof(yes)) < 0) ||
--
2.24.1.windows.2
More information about the ffmpeg-devel
mailing list