[FFmpeg-cvslog] ffserver: make statement block unconditional by exiting early

Reynaldo H. Verdejo Pinochet git at videolan.org
Thu Jun 25 00:18:30 CEST 2015


ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com> | Wed Jun 24 19:03:19 2015 -0300| [08724da976e9645488c215327a47c2c5a51fbe33] | committer: Reynaldo H. Verdejo Pinochet

ffserver: make statement block unconditional by exiting early

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=08724da976e9645488c215327a47c2c5a51fbe33
---

 ffserver.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index b9b6d96..5082a4c 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -3771,24 +3771,24 @@ static void compute_bandwidth(void)
 static void handle_child_exit(int sig)
 {
     pid_t pid;
-    int status;
+    int status, uptime;
 
     while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
         FFServerStream *feed;
 
         for (feed = config.first_feed; feed; feed = feed->next) {
-            if (feed->pid == pid) {
-                int uptime = time(0) - feed->pid_start;
+            if (feed->pid != pid)
+                continue;
 
-                feed->pid = 0;
-                fprintf(stderr,
-                        "%s: Pid %d exited with status %d after %d seconds\n",
-                        feed->filename, pid, status, uptime);
+            uptime = time(0) - feed->pid_start;
+            feed->pid = 0;
+            fprintf(stderr,
+                    "%s: Pid %d exited with status %d after %d seconds\n",
+                    feed->filename, pid, status, uptime);
 
-                if (uptime < 30)
-                    /* Turn off any more restarts */
-                    ffserver_free_child_args(&feed->child_argv);
-            }
+            if (uptime < 30)
+                /* Turn off any more restarts */
+                ffserver_free_child_args(&feed->child_argv);
         }
     }
 



More information about the ffmpeg-cvslog mailing list