[FFmpeg-cvslog] ffserver: reflow start_multicast()

Reynaldo H. Verdejo Pinochet git at videolan.org
Fri Dec 26 22:21:29 CET 2014


ffmpeg | branch: master | Reynaldo H. Verdejo Pinochet <reynaldo at osg.samsung.com> | Fri Dec 26 18:03:25 2014 -0300| [719cc025869b59bbdc438ffe2236a0c7e0062d17] | committer: Reynaldo H. Verdejo Pinochet

ffserver: reflow start_multicast()

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

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

 ffserver.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 94d315f..0094d28 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -489,12 +489,14 @@ static void start_multicast(void)
     HTTPContext *rtp_c;
     struct sockaddr_in dest_addr = {0};
     int default_port, stream_index;
+    unsigned int random0, random1;
 
     default_port = 6000;
     for(stream = config.first_stream; stream; stream = stream->next) {
-        if (stream->is_multicast) {
-            unsigned random0 = av_lfg_get(&random_state);
-            unsigned random1 = av_lfg_get(&random_state);
+        if (!stream->is_multicast)
+            continue;
+            random0 = av_lfg_get(&random_state);
+            random1 = av_lfg_get(&random_state);
             /* open the RTP connection */
             snprintf(session_id, sizeof(session_id), "%08x%08x",
                      random0, random1);
@@ -525,15 +527,16 @@ static void start_multicast(void)
                 stream_index++) {
                 dest_addr.sin_port = htons(stream->multicast_port +
                                            2 * stream_index);
-                if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, NULL) < 0) {
+                if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, NULL)
+                    >= 0) {
+                    continue;
+                }
                     http_log("Could not open output stream '%s/streamid=%d'\n",
                              stream->filename, stream_index);
                     exit(1);
-                }
             }
 
             rtp_c->state = HTTPSTATE_SEND_DATA;
-        }
     }
 }
 



More information about the ffmpeg-cvslog mailing list