summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJun Zhao <mypopydev@gmail.com>2018-05-06 22:56:01 +0800
committerJun Zhao <jun.zhao@intel.com>2018-07-26 19:03:24 +0800
commit790cf9518a37ae7d2fb65d9d52111fc4ac4b7df0 (patch)
treeb989d72d2dc3d8485b3353583a717395d656681c
parentbce4da85e8110b66040a5fb07ffc724ab4e09a86 (diff)
downloadffmpeg-streaming-790cf9518a37ae7d2fb65d9d52111fc4ac4b7df0.zip
ffmpeg-streaming-790cf9518a37ae7d2fb65d9d52111fc4ac4b7df0.tar.gz
lavf/tcp: add option to setting Maximum Segment Size
This can change the the MSS value announced to the other end in the initial TCP packet, it's can be used when failed Path MTU discovery. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
-rw-r--r--libavformat/tcp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index b0289f8..499e365 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -42,6 +42,9 @@ typedef struct TCPContext {
int recv_buffer_size;
int send_buffer_size;
int tcp_nodelay;
+#if !HAVE_WINSOCK2_H
+ int tcp_mss;
+#endif /* !HAVE_WINSOCK2_H */
} TCPContext;
#define OFFSET(x) offsetof(TCPContext, x)
@@ -54,6 +57,9 @@ static const AVOption options[] = {
{ "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 },
{ "tcp_nodelay", "Use TCP_NODELAY to disable nagle's algorithm", OFFSET(tcp_nodelay), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = D|E },
+#if !HAVE_WINSOCK2_H
+ { "tcp_mss", "Maximum segment size for outgoing TCP packets", OFFSET(tcp_mss), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
+#endif /* !HAVE_WINSOCK2_H */
{ NULL }
};
@@ -153,6 +159,11 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
if (s->tcp_nodelay > 0) {
setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &s->tcp_nodelay, sizeof (s->tcp_nodelay));
}
+#if !HAVE_WINSOCK2_H
+ if (s->tcp_mss > 0) {
+ setsockopt (fd, IPPROTO_TCP, TCP_MAXSEG, &s->tcp_mss, sizeof (s->tcp_mss));
+ }
+#endif /* !HAVE_WINSOCK2_H */
if (s->listen == 2) {
// multi-client
OpenPOWER on IntegriCloud