diff options
author | Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com> | 2014-12-09 02:57:02 -0300 |
---|---|---|
committer | Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com> | 2014-12-26 17:45:56 -0300 |
commit | ec42251715294719e790e4cc48b29f99e74b2a65 (patch) | |
tree | f0e453172abd9e8adaf735c2af25702ed82a0346 /ffserver.c | |
parent | 1abdfb100ac6b47b20db1af7b3402c3517c4b9d4 (diff) | |
download | ffmpeg-ec42251715294719e790e4cc48b29f99e74b2a65.tar.gz |
ffserver: reflow start_children()
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Diffstat (limited to 'ffserver.c')
-rw-r--r-- | ffserver.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/ffserver.c b/ffserver.c index 5ae7406626..d1e66387df 100644 --- a/ffserver.c +++ b/ffserver.c @@ -384,11 +384,29 @@ static int compute_datarate(DataRateData *drd, int64_t count) static void start_children(FFServerStream *feed) { + char pathname[1024]; + char *slash; + int i; + if (no_launch) return; + /* replace "ffserver" with "ffmpeg" in the path of current + * program. Ignore user provided path */ + av_strlcpy(pathname, my_program_name, sizeof(pathname)); + + slash = strrchr(pathname, '/'); + if (!slash) + slash = pathname; + else + slash++; + strcpy(slash, "ffmpeg"); + for (; feed; feed = feed->next) { - if (feed->child_argv && !feed->pid) { + + if (!feed->child_argv || feed->pid) + continue; + feed->pid_start = time(0); feed->pid = fork(); @@ -397,21 +415,11 @@ static void start_children(FFServerStream *feed) http_log("Unable to create children\n"); exit(1); } - if (!feed->pid) { + + if (feed->pid) + continue; + /* In child */ - char pathname[1024]; - char *slash; - int i; - - /* replace "ffserver" with "ffmpeg" in the path of current - * program. Ignore user provided path */ - av_strlcpy(pathname, my_program_name, sizeof(pathname)); - slash = strrchr(pathname, '/'); - if (!slash) - slash = pathname; - else - slash++; - strcpy(slash, "ffmpeg"); http_log("Launch command line: "); http_log("%s ", pathname); @@ -436,8 +444,6 @@ static void start_children(FFServerStream *feed) execvp(pathname, feed->child_argv); _exit(1); - } - } } } |