[FFmpeg-devel] libavformat/tcp.c : add send_buffer_size and recv_buffer_size options
Michael Niedermayer
michael at niedermayer.cc
Tue Jan 19 18:02:17 CET 2016
On Fri, Jan 15, 2016 at 10:16:45PM -0500, Perette Barella wrote:
> On 2016年01月15日, at 18:42, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > no, theres no patch
>
>
> Trying again, including it inline below:
>
> --- tcp.c 2015-12-19 21:07:51.000000000 -0500
> +++ /Users/perette/Desktop/tcp.c 2016-01-15 16:09:03.000000000 -0500
> @@ -37,19 +37,23 @@
> int fd;
> int listen;
> int open_timeout;
> int rw_timeout;
> int listen_timeout;
> + int recv_buffer_size;
> + int send_buffer_size;
> } TCPContext;
>
> #define OFFSET(x) offsetof(TCPContext, x)
> #define D AV_OPT_FLAG_DECODING_PARAM
> #define E AV_OPT_FLAG_ENCODING_PARAM
> static const AVOption options[] = {
> - { "listen", "Listen for incoming connections", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, .flags = D|E },
> - { "timeout", "set timeout (in microseconds) of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
> - { "listen_timeout", "Connection awaiting timeout (in milliseconds)", OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
> + { "listen", "Listen for incoming connections", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, .flags = D|E },
> + { "timeout", "set timeout (in microseconds) of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
> + { "listen_timeout", "Connection awaiting timeout (in milliseconds)", OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E },
cleaning up the indention is welcome, but please in a seperate patch
> + { "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 },
> { NULL }
> };
>
> static const AVClass tcp_class = {
> .class_name = "tcp",
> @@ -148,10 +152,19 @@
> }
> }
>
> h->is_streamed = 1;
> s->fd = fd;
> + /* Set the socket's send or receive buffer sizes, if specified.
> + If unspecified or setting fails, system default is used. */
> + if (s->recv_buffer_size > 0) {
> + setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &s->recv_buffer_size, sizeof (s->recv_buffer_size));
> + }
> + if (s->send_buffer_size > 0) {
> + setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &s->send_buffer_size, sizeof (s->send_buffer_size));
> + }
tabs arent allowed in ffmpeg git (except makefiles)
SO_RCVBUF occurs twice, is that intended ?
also an update to the docs is needed
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160119/72ce19f1/attachment.sig>
More information about the ffmpeg-devel
mailing list