From 719cc025869b59bbdc438ffe2236a0c7e0062d17 Mon Sep 17 00:00:00 2001 From: "Reynaldo H. Verdejo Pinochet" Date: Fri, 26 Dec 2014 18:03:25 -0300 Subject: [PATCH] ffserver: reflow start_multicast() Signed-off-by: Reynaldo H. Verdejo Pinochet --- ffserver.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ffserver.c b/ffserver.c index 94d315f994..0094d2831c 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; - } } }