Hi there, I am Binathi, applying for FOSS OPW Round 9, for contributing to FFmpeg.
As a part of my qualification task, I had been working on bug " #3731 open defect ffserver daemon mode " [https://trac.ffmpeg.org/ticket/3731] I changed two files and uploaded them onto my git repository [ https://github.com/Binathi/ffserver] to allow ffserver run in daemon mode in ffmpeg 2.4.2 version After making changes, you should do (from within your ffmpeg source code directory) [1] ./configure (Required, if you haven't done this before) make ffserver [2] copy ffserver.conf to /some/place/else/ and then do "./ffserver -f /some/place/else/ffserver.conf" to start a new ffserver instance running in daemon mode Patch to ffserver.conf, 2 insertions # '-' is the standard output. CustomLog - +# Suppress that if you don't want to launch ffserver as a daemon. +Daemon ####################################################### Patch to ffserver.c 2 deletions, 22 insertions static int ffserver_debug; +static int ffserver_daemon; static int no_launch; ............. if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { ERROR("%s:%d: Invalid host/IP address: %s\n", arg);} } -+else if (!av_strcasecmp(cmd, "Daemon")) { +ffserver_daemon = 1; -WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "RTSPPort")) { ................. static void opt_debug(void) { ffserver_debug = 1; +ffserver_daemon = 1; logfilename[0] = '-'; ................ int main(int argc, char **argv) { struct sigaction sigact = { { 0 } }; int ret = 0; +ffserver_daemon = 0; config_filename = av_strdup("/etc/ffserver.conf"); ................. compute_bandwidth(); +if(ffserver_daemon){ +int ffserver_id = 0; +pid_t sid = 0; +ffserver_id = fork(); // Create child process +if (ffserver_id < 0){ +printf("fork failed!\n"); //Indication of failure +exit(1); } +if(ffserver_id > 0){ //Parent process need to kill +exit(0); } +sid = setsid(); //set new session +if(sid < 0){ +exit(1); //return failure } +open ("/dev/null", O_RDWR); +if (strcmp(logfilename, "-") != 0) { +close(1); } } /* signal init */ signal(SIGPIPE, SIG_IGN); +if (ffserver_daemon) +chdir("/"); if (http_server() < 0) { ............ } Cheers, Binathi "living with taking zero risks is extremely risky!" - Robert Sharma _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel