ffserver: reflow start_multicast()

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2014-12-26 18:03:25 -03:00
parent 18011888cc
commit 719cc02586
1 changed files with 9 additions and 6 deletions

View File

@ -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,16 +527,17 @@ 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;
}
}
}
/* main loop of the HTTP server */