mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-03 21:42:09 +00:00
Merge commit 'ea8ae27a5e112d06fd5625f640e40849e6313f0c'
* commit 'ea8ae27a5e112d06fd5625f640e40849e6313f0c': avformat/libsrt: add payload size option Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
commit
b1b0e53258
@ -1255,6 +1255,21 @@ 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).
|
||||
|
||||
@item payload_size=@var{bytes}
|
||||
Sets the maximum declared size of a packet transferred
|
||||
during the single call to the sending function in Live
|
||||
mode. Use 0 if this value isn't used (which is default in
|
||||
file mode).
|
||||
Default is -1 (automatic), which typically means MPEG-TS;
|
||||
if you are going to use SRT
|
||||
to send any different kind of payload, such as, for example,
|
||||
wrapping a live stream in very small frames, then you can
|
||||
use a bigger maximum frame size, though not greater than
|
||||
1456 bytes.
|
||||
|
||||
@item pkt_size=@var{bytes}
|
||||
Alias for @samp{payload_size}.
|
||||
|
||||
@item pbkeylen=@var{bytes}
|
||||
Sender encryption key length, in bytes.
|
||||
Only can be set to 0, 16, 24 and 32.
|
||||
@ -1263,12 +1278,6 @@ Not required on receiver (set to 0),
|
||||
key size obtained from sender in HaiCrypt handshake.
|
||||
Default value is 0.
|
||||
|
||||
@item pkt_size=@var{bytes}
|
||||
Set maximum SRT payload size, expressed in bytes. Default is -1 (automatic),
|
||||
which typically means 1316 as that is the libsrt default for live mode. Libsrt
|
||||
can also support payload sizes up to 1456 bytes. (MTU(1500) - UDP.hdr(28) -
|
||||
SRT.hdr(16))
|
||||
|
||||
@item recv_buffer_size=@var{bytes}
|
||||
Set receive buffer size, expressed in bytes.
|
||||
|
||||
|
@ -34,6 +34,16 @@
|
||||
#include "os_support.h"
|
||||
#include "url.h"
|
||||
|
||||
/* This is for MPEG-TS and it's a default SRTO_PAYLOADSIZE for SRTT_LIVE (8 TS packets) */
|
||||
#ifndef SRT_LIVE_DEFAULT_PAYLOAD_SIZE
|
||||
#define SRT_LIVE_DEFAULT_PAYLOAD_SIZE 1316
|
||||
#endif
|
||||
|
||||
/* This is the maximum payload size for Live mode, should you have a different payload type than MPEG-TS */
|
||||
#ifndef SRT_LIVE_MAX_PAYLOAD_SIZE
|
||||
#define SRT_LIVE_MAX_PAYLOAD_SIZE 1456
|
||||
#endif
|
||||
|
||||
enum SRTMode {
|
||||
SRT_MODE_CALLER = 0,
|
||||
SRT_MODE_LISTENER = 1,
|
||||
@ -48,7 +58,6 @@ typedef struct SRTContext {
|
||||
int64_t listen_timeout;
|
||||
int recv_buffer_size;
|
||||
int send_buffer_size;
|
||||
int pkt_size;
|
||||
|
||||
int64_t maxbw;
|
||||
int pbkeylen;
|
||||
@ -63,6 +72,7 @@ typedef struct SRTContext {
|
||||
int tlpktdrop;
|
||||
int nakreport;
|
||||
int64_t connect_timeout;
|
||||
int payload_size;
|
||||
enum SRTMode mode;
|
||||
} SRTContext;
|
||||
|
||||
@ -74,7 +84,10 @@ static const AVOption libsrt_options[] = {
|
||||
{ "listen_timeout", "Connection awaiting timeout", OFFSET(listen_timeout), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
|
||||
{ "send_buffer_size", "Socket send buffer size (in bytes)", OFFSET(send_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
|
||||
{ "recv_buffer_size", "Socket receive buffer size (in bytes)", OFFSET(recv_buffer_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
|
||||
{ "pkt_size", "Maximum SRT packet size", OFFSET(pkt_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
|
||||
{ "pkt_size", "Maximum SRT packet size", OFFSET(payload_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, SRT_LIVE_MAX_PAYLOAD_SIZE, .flags = D|E, "payload_size" },
|
||||
{ "payload_size", "Maximum SRT packet size", OFFSET(payload_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, SRT_LIVE_MAX_PAYLOAD_SIZE, .flags = D|E, "payload_size" },
|
||||
{ "ts_size", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = SRT_LIVE_DEFAULT_PAYLOAD_SIZE }, INT_MIN, INT_MAX, .flags = D|E, "payload_size" },
|
||||
{ "max_size", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = SRT_LIVE_MAX_PAYLOAD_SIZE }, INT_MIN, INT_MAX, .flags = D|E, "payload_size" },
|
||||
{ "maxbw", "Maximum bandwidth (bytes per second) that the connection can use", OFFSET(maxbw), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, INT64_MAX, .flags = D|E },
|
||||
{ "pbkeylen", "Crypto key len in bytes {16,24,32} Default: 16 (128-bit)", OFFSET(pbkeylen), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 32, .flags = D|E },
|
||||
{ "passphrase", "Crypto PBKDF2 Passphrase size[0,10..64] 0:disable crypto", OFFSET(passphrase), AV_OPT_TYPE_STRING, { .str = NULL }, .flags = D|E },
|
||||
@ -287,8 +300,8 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
|
||||
(tsbpddelay >= 0 && libsrt_setsockopt(h, fd, SRTO_TSBPDDELAY, "SRTO_TSBPDELAY", &tsbpddelay, sizeof(tsbpddelay)) < 0) ||
|
||||
(s->tlpktdrop >= 0 && libsrt_setsockopt(h, fd, SRTO_TLPKTDROP, "SRTO_TLPKDROP", &s->tlpktdrop, sizeof(s->tlpktdrop)) < 0) ||
|
||||
(s->nakreport >= 0 && libsrt_setsockopt(h, fd, SRTO_NAKREPORT, "SRTO_NAKREPORT", &s->nakreport, sizeof(s->nakreport)) < 0) ||
|
||||
(s->pkt_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->pkt_size, sizeof(s->pkt_size)) < 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) {
|
||||
return AVERROR(EIO);
|
||||
}
|
||||
return 0;
|
||||
@ -464,9 +477,6 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
|
||||
if (av_find_info_tag(buf, sizeof(buf), "oheadbw", p)) {
|
||||
s->oheadbw = strtoll(buf, NULL, 10);
|
||||
}
|
||||
if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
|
||||
s->pkt_size = strtol(buf, NULL, 10);
|
||||
}
|
||||
if (av_find_info_tag(buf, sizeof(buf), "tsbpddelay", p)) {
|
||||
s->tsbpddelay = strtol(buf, NULL, 10);
|
||||
}
|
||||
@ -479,6 +489,9 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
|
||||
if (av_find_info_tag(buf, sizeof(buf), "connect_timeout", p)) {
|
||||
s->connect_timeout = strtol(buf, NULL, 10);
|
||||
}
|
||||
if (av_find_info_tag(buf, sizeof(buf), "payload_size", p)) {
|
||||
s->payload_size = strtol(buf, NULL, 10);
|
||||
}
|
||||
if (av_find_info_tag(buf, sizeof(buf), "mode", p)) {
|
||||
if (!strcmp(buf, "caller")) {
|
||||
s->mode = SRT_MODE_CALLER;
|
||||
|
@ -33,7 +33,7 @@
|
||||
// Also please add any ticket numbers that you believe might be affected here
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 58
|
||||
#define LIBAVFORMAT_VERSION_MINOR 17
|
||||
#define LIBAVFORMAT_VERSION_MICRO 104
|
||||
#define LIBAVFORMAT_VERSION_MICRO 105
|
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user