Commit 3b899fc7 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Assign default streamer ports depending on sensor port

parent 07e65a43
...@@ -468,7 +468,7 @@ string RTSP_Server::make_transport(string req) { ...@@ -468,7 +468,7 @@ string RTSP_Server::make_transport(string req) {
string first, second; string first, second;
String::split(client_port, '-', first, second); String::split(client_port, '-', first, second);
port_req = atol(first.c_str()); port_req = atol(first.c_str());
//D(cerr << "client_port == |" << client_port << "|; first == |" << first << "|; second == |" << "|" << endl;) D(cerr << "client_port == |" << client_port << "|; first == |" << first << "|; second == |" << second << "|" << endl;)
// session->rtp_out.port = first; // session->rtp_out.port = first;
} }
......
...@@ -363,10 +363,12 @@ int Streamer::handler(RTSP_Server *rtsp_server, RTSP_Server::event event) { ...@@ -363,10 +363,12 @@ int Streamer::handler(RTSP_Server *rtsp_server, RTSP_Server::event event) {
static bool _play = false; static bool _play = false;
D(sensor_port, cerr << "event: running= " << running << " "); D(sensor_port, cerr << "event: running= " << running << " ");
switch (event) { switch (event) {
case RTSP_Server::DESCRIBE: /// Update frame size, fps before starting new stream (generating SDP file) case RTSP_Server::DESCRIBE:
// update frame size, fps before starting new stream (generating SDP file)
update_settings(true); update_settings(true);
break; break;
case RTSP_Server::PARAMS_WAS_CHANGED: /// Update frame size, fps before starting new stream (generating SDP file) case RTSP_Server::PARAMS_WAS_CHANGED:
// update frame size, fps before starting new stream (generating SDP file)
return (update_settings(false) || !(params->daemon_enabled())); return (update_settings(false) || !(params->daemon_enabled()));
case RTSP_Server::PLAY: case RTSP_Server::PLAY:
D(sensor_port, cerr << "==PLAY=="); D(sensor_port, cerr << "==PLAY==");
...@@ -374,8 +376,7 @@ int Streamer::handler(RTSP_Server *rtsp_server, RTSP_Server::event event) { ...@@ -374,8 +376,7 @@ int Streamer::handler(RTSP_Server *rtsp_server, RTSP_Server::event event) {
int ttl = -1; int ttl = -1;
if (session->rtp_out.multicast) if (session->rtp_out.multicast)
ttl = atoi(session->rtp_out.ttl.c_str()); ttl = atoi(session->rtp_out.ttl.c_str());
video->Start(session->rtp_out.ip, session->rtp_out.port_video, session->video.fps_scale, video->Start(session->rtp_out.ip, session->rtp_out.port_video, session->video.fps_scale, ttl);
ttl);
if (audio != NULL) if (audio != NULL)
audio->Start(session->rtp_out.ip, session->rtp_out.port_audio, ttl); audio->Start(session->rtp_out.ip, session->rtp_out.port_audio, ttl);
} }
...@@ -440,7 +441,7 @@ int Streamer::handler(RTSP_Server *rtsp_server, RTSP_Server::event event) { ...@@ -440,7 +441,7 @@ int Streamer::handler(RTSP_Server *rtsp_server, RTSP_Server::event event) {
void Streamer::Main(void) { void Streamer::Main(void) {
D(sensor_port, cerr << "start Main for sensor port " << sensor_port << endl); D(sensor_port, cerr << "start Main for sensor port " << sensor_port << endl);
int def_port = 20020; int def_port = 20020 + 4 * sensor_port; // +4 because RTP port should be an even number and each stream can occupy 2 ports
string def_ttl = "2"; string def_ttl = "2";
session->rtp_out.ip_cached = 0; session->rtp_out.ip_cached = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment