[FFmpeg-devel] How to extend MaxClients limit?
Baptiste Coudurier
baptiste.coudurier
Wed Sep 3 03:39:17 CEST 2008
Hi,
Stefano Sabatini wrote:
> On date Tuesday 2008-09-02 14:27:19 +0200, Stefano Sabatini encoded:
>> On date Tuesday 2008-09-02 15:29:00 +0400, ??????? ?????? encoded:
>>> Sorry, for incorrect send and thanks for point. I'm already found it, but need to be approved as good one :)
>>>> On Tue, 02 Sep 2008 15:17:18 +0400, ??????? ?????? wrote:
>>>>> Hello,
>>>>>
>>>>> We need to broadcast flv streams over 10000 clients. Now ffserver disallow MaxClients settings over 2000 limit. Can i'm make some trick to extends this?
>>>> ffmpeg-devel is for development or patches for ffmpeg.
>>>> your question should be sent to ffmpeg-user
>>>> look at line 63 of ffserver.c:
>>>> /* maximum number of simultaneous HTTP connections */
>>>> #define HTTP_MAX_CONNECTIONS 2000
>> Maybe we should make that parameter configuration-dependant (maybe
>> this will require some kind of dynamic allocation).
>
> Like this.
>
> Regards.
>
>
> ------------------------------------------------------------------------
>
> Index: ffserver.c
> ===================================================================
> --- ffserver.c (revision 15154)
> +++ ffserver.c (working copy)
> @@ -62,9 +62,6 @@
>
> static const OptionDef options[];
>
> -/* maximum number of simultaneous HTTP connections */
> -#define HTTP_MAX_CONNECTIONS 2000
> -
> enum HTTPState {
> HTTPSTATE_WAIT_REQUEST,
> HTTPSTATE_SEND_HEADER,
> @@ -295,6 +292,8 @@
> static int no_launch;
> static int need_to_start_children;
>
> +/* maximum number of simultaneous HTTP connections */
> +unsigned int nb_max_http_connections = 2000;
> static int nb_max_connections = 5;
> static int nb_connections;
>
> @@ -543,9 +542,14 @@
> {
> int server_fd = 0, rtsp_server_fd = 0;
> int ret, delay, delay1;
> - struct pollfd poll_table[HTTP_MAX_CONNECTIONS + 2], *poll_entry;
> + struct pollfd *poll_table, *poll_entry;
> HTTPContext *c, *c_next;
>
> + if(!(poll_table = av_mallocz(nb_max_http_connections + 2))) {
> + http_log("Impossible to allocate a poll table handling %d connections.\n", nb_max_http_connections);
> + return -1;
> + }
> +
> if (my_http_addr.sin_port) {
> server_fd = socket_open_listen(&my_http_addr);
> if (server_fd < 0)
> @@ -3816,10 +3820,19 @@
> filename, line_num, arg);
> errors++;
> }
> + } else if (!strcasecmp(cmd, "MaxHTTPConnections")) {
> + get_arg(arg, sizeof(arg), &p);
> + val = atoi(arg);
> + if (val < 1 || val > 65536) {
> + fprintf(stderr, "%s:%d: Invalid MaxHTTPConnections: %s\n",
> + filename, line_num, arg);
> + errors++;
> + }
> + nb_max_http_connections = val;
> } else if (!strcasecmp(cmd, "MaxClients")) {
> get_arg(arg, sizeof(arg), &p);
> val = atoi(arg);
> - if (val < 1 || val > HTTP_MAX_CONNECTIONS) {
> + if (val < 1 || val > nb_max_http_connections) {
> fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n",
> filename, line_num, arg);
> errors++;
> Index: doc/ffserver.conf
> ===================================================================
> --- doc/ffserver.conf (revision 15154)
> +++ doc/ffserver.conf (working copy)
> @@ -7,6 +7,11 @@
> # several network interfaces.
> BindAddress 0.0.0.0
>
> +# Number of simultaneous HTTP connections that can be handled. It has
> +# to be defined *before* the MaxClient parameter, since it defines the
> +# MaxClient maximum limit.
> +MaxHTTPConnections 2000
> +
> # Number of simultaneous requests that can be handled. Since FFServer
> # is very fast, it is more likely that you will want to leave this high
> # and use MaxBandwidth, below.
>
Patch ok.
--
Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA
Smartjog USA Inc. http://www.smartjog.com
Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
More information about the ffmpeg-devel
mailing list