Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Reynaldo H. Verdejo Pinochet authored on 2014/12/27 06:17:47... | ... |
@@ -493,50 +493,52 @@ static void start_multicast(void) |
493 | 493 |
|
494 | 494 |
default_port = 6000; |
495 | 495 |
for(stream = config.first_stream; stream; stream = stream->next) { |
496 |
+ |
|
496 | 497 |
if (!stream->is_multicast) |
497 | 498 |
continue; |
498 |
- random0 = av_lfg_get(&random_state); |
|
499 |
- random1 = av_lfg_get(&random_state); |
|
500 |
- /* open the RTP connection */ |
|
501 |
- snprintf(session_id, sizeof(session_id), "%08x%08x", |
|
502 |
- random0, random1); |
|
503 |
- |
|
504 |
- /* choose a port if none given */ |
|
505 |
- if (stream->multicast_port == 0) { |
|
506 |
- stream->multicast_port = default_port; |
|
507 |
- default_port += 100; |
|
508 |
- } |
|
509 | 499 |
|
510 |
- dest_addr.sin_family = AF_INET; |
|
511 |
- dest_addr.sin_addr = stream->multicast_ip; |
|
512 |
- dest_addr.sin_port = htons(stream->multicast_port); |
|
500 |
+ random0 = av_lfg_get(&random_state); |
|
501 |
+ random1 = av_lfg_get(&random_state); |
|
513 | 502 |
|
514 |
- rtp_c = rtp_new_connection(&dest_addr, stream, session_id, |
|
515 |
- RTSP_LOWER_TRANSPORT_UDP_MULTICAST); |
|
516 |
- if (!rtp_c) |
|
517 |
- continue; |
|
503 |
+ /* open the RTP connection */ |
|
504 |
+ snprintf(session_id, sizeof(session_id), "%08x%08x", |
|
505 |
+ random0, random1); |
|
506 |
+ |
|
507 |
+ /* choose a port if none given */ |
|
508 |
+ if (stream->multicast_port == 0) { |
|
509 |
+ stream->multicast_port = default_port; |
|
510 |
+ default_port += 100; |
|
511 |
+ } |
|
518 | 512 |
|
519 |
- if (open_input_stream(rtp_c, "") < 0) { |
|
520 |
- http_log("Could not open input stream for stream '%s'\n", |
|
521 |
- stream->filename); |
|
513 |
+ dest_addr.sin_family = AF_INET; |
|
514 |
+ dest_addr.sin_addr = stream->multicast_ip; |
|
515 |
+ dest_addr.sin_port = htons(stream->multicast_port); |
|
516 |
+ |
|
517 |
+ rtp_c = rtp_new_connection(&dest_addr, stream, session_id, |
|
518 |
+ RTSP_LOWER_TRANSPORT_UDP_MULTICAST); |
|
519 |
+ if (!rtp_c) |
|
520 |
+ continue; |
|
521 |
+ |
|
522 |
+ if (open_input_stream(rtp_c, "") < 0) { |
|
523 |
+ http_log("Could not open input stream for stream '%s'\n", |
|
524 |
+ stream->filename); |
|
525 |
+ continue; |
|
526 |
+ } |
|
527 |
+ |
|
528 |
+ /* open each RTP stream */ |
|
529 |
+ for(stream_index = 0; stream_index < stream->nb_streams; |
|
530 |
+ stream_index++) { |
|
531 |
+ dest_addr.sin_port = htons(stream->multicast_port + |
|
532 |
+ 2 * stream_index); |
|
533 |
+ if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, NULL) >= 0) |
|
522 | 534 |
continue; |
523 |
- } |
|
524 | 535 |
|
525 |
- /* open each RTP stream */ |
|
526 |
- for(stream_index = 0; stream_index < stream->nb_streams; |
|
527 |
- stream_index++) { |
|
528 |
- dest_addr.sin_port = htons(stream->multicast_port + |
|
529 |
- 2 * stream_index); |
|
530 |
- if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, NULL) |
|
531 |
- >= 0) { |
|
532 |
- continue; |
|
533 |
- } |
|
534 |
- http_log("Could not open output stream '%s/streamid=%d'\n", |
|
535 |
- stream->filename, stream_index); |
|
536 |
- exit(1); |
|
537 |
- } |
|
536 |
+ http_log("Could not open output stream '%s/streamid=%d'\n", |
|
537 |
+ stream->filename, stream_index); |
|
538 |
+ exit(1); |
|
539 |
+ } |
|
538 | 540 |
|
539 |
- rtp_c->state = HTTPSTATE_SEND_DATA; |
|
541 |
+ rtp_c->state = HTTPSTATE_SEND_DATA; |
|
540 | 542 |
} |
541 | 543 |
} |
542 | 544 |
|