summaryrefslogtreecommitdiff
path: root/libavformat/libsrt.c
diff options
context:
space:
mode:
authorZhao Zhili <zhilizhao@tencent.com>2021-06-04 15:22:28 +0800
committerMarton Balint <cus@passwd.hu>2021-06-09 00:07:10 +0200
commit55c54ff74455c70aee243c944c124a04ecdb2d9d (patch)
tree7edc960742ea94e1cf67c7c858c992e41fe59178 /libavformat/libsrt.c
parent9099046cc76c9e3bf02f62a237b4d444cdaf5b20 (diff)
avformat/libsrt: add tsbpd option
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/libsrt.c')
-rw-r--r--libavformat/libsrt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index edebb49edf..3a57ac53cb 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -90,6 +90,7 @@ typedef struct SRTContext {
int messageapi;
SRT_TRANSTYPE transtype;
int linger;
+ int tsbpd;
} SRTContext;
#define D AV_OPT_FLAG_DECODING_PARAM
@@ -140,6 +141,7 @@ static const AVOption libsrt_options[] = {
{ "live", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = SRTT_LIVE }, INT_MIN, INT_MAX, .flags = D|E, "transtype" },
{ "file", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = SRTT_FILE }, INT_MIN, INT_MAX, .flags = D|E, "transtype" },
{ "linger", "Number of seconds that the socket waits for unsent data when closing", OFFSET(linger), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
+ { "tsbpd", "Timestamp-based packet delivery", OFFSET(tsbpd), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, .flags = D|E },
{ NULL }
};
@@ -349,7 +351,8 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
#endif
(s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, "SRTO_MESSAGEAPI", &s->messageapi, sizeof(s->messageapi)) < 0) ||
(s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) ||
- ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0)) {
+ ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0) ||
+ (s->tsbpd >= 0 && libsrt_setsockopt(h, fd, SRTO_TSBPDMODE, "SRTO_TSBPDMODE", &s->tsbpd, sizeof(s->tsbpd)) < 0)) {
return AVERROR(EIO);
}