diff --git a/src/zm_event.cpp b/src/zm_event.cpp index e0940be2d..249da9ba8 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -103,6 +103,18 @@ bool Event::OpenFrameSocket( int monitor_id ) return( false ); } + int socket_buffer_size = (int)config.Item( ZM_FRAME_SOCKET_SIZE ); + if ( socket_buffer_size > 0 ) + { + if ( setsockopt( sd, SOL_SOCKET, SO_SNDBUF, &socket_buffer_size, sizeof(socket_buffer_size) ) < 0 ) + { + Error(( "Can't get socket buffer size to %d, error = %s", socket_buffer_size, strerror(errno) )); + close( sd ); + sd = -1; + return( false ); + } + } + int flags; if ( (flags = fcntl( sd, F_GETFL )) < 0 ) { diff --git a/zmconfig.pl.in b/zmconfig.pl.in index e58f24ea1..010d177c9 100755 --- a/zmconfig.pl.in +++ b/zmconfig.pl.in @@ -349,15 +349,6 @@ my @options = type => $types{boolean}, category => 'video', }, - { - name => "ZM_OPT_FRAME_SERVER", - default => "no", - description => "Should analysis farm out the writing of images to disk", - #requires => [ { name => "ZM_OPT_ADAPTIVE_SKIP", value => "yes" } ], - help => "In some circumstances it is possible for a slow disk to take so long writing images to disk that it causes the analysis daemon to fall behind especially during high frame rate events. Setting this option to yes enables a frame server daemon (zmf) which will be sent the images from the analysis daemon and will do the actual writing of images itself freeing up the analysis daemon to get on with other things. Should this transmission fail or other permanent or transient error occur, this function will fall back to the analysis daemon.", - type => $types{boolean}, - category => 'video', - }, { name => "ZM_OPT_REMOTE_CAMERAS", default => "no", @@ -835,6 +826,24 @@ my @options = type => $types{boolean}, category => 'system', }, + { + name => "ZM_OPT_FRAME_SERVER", + default => "no", + description => "Should analysis farm out the writing of images to disk", + #requires => [ { name => "ZM_OPT_ADAPTIVE_SKIP", value => "yes" } ], + help => "In some circumstances it is possible for a slow disk to take so long writing images to disk that it causes the analysis daemon to fall behind especially during high frame rate events. Setting this option to yes enables a frame server daemon (zmf) which will be sent the images from the analysis daemon and will do the actual writing of images itself freeing up the analysis daemon to get on with other things. Should this transmission fail or other permanent or transient error occur, this function will fall back to the analysis daemon.", + type => $types{boolean}, + category => 'system', + }, + { + name => "ZM_FRAME_SOCKET_SIZE", + default => "0", + description => "Specify the size of the frame server socket buffer if non-standard", + requires => [ { name => "ZM_OPT_FRAME_SERVER", value => "yes" } ], + help => "For large captured images it is possible for the writes from the analysis daemon to the frame server to fail as the amount to be written exceeds the default buffer size. While the images are then written by the analysis daemon so no data is lost, it defeats the object of the frame server daemon in the first place. You can use this option to indicate that a larger buffer size should be used. Note that you may have to change the existing maximum socket buffer size on your system via sysctl (or in /proc/sys/net/core/wmem_max) to allow this new size to be set. Alternatively you can change the default buffer size on your system in the same way in which case that will be used with no change necessary in this option", + type => $types{integer}, + category => 'system', + }, { name => "ZM_CHECK_FOR_UPDATES", default => "yes", @@ -929,7 +938,7 @@ my @options = name => "ZM_WEB_H_IMAGE_SCALING", default => "1", description => "How to scale thumbnails in events, bandwidth versus cpu in rescaling", - help => "A value of 1 sends the whole image to the browser which resizes it in the window, larger values scale down by that amount on the server before sending a reduced size image to the browser. For high bandwidth settings the default of 1 is usally the fastest does not result in extraneous thumbnail files being generated.", + help => "A value of 1 sends the whole image to the browser which resizes it in the window, larger values scale down by that amount on the server before sending a reduced size image to the browser. For high bandwidth settings the default of 1 is usually the fastest and also does not result in extraneous thumbnail files being generated.", type => $types{integer}, requires => [ { name=>"ZM_PATH_NETPBM", value=>'/' } ], category => 'highband',