Fixed socket binding for TS UDP push output
This commit is contained in:
parent
25ed47c97f
commit
4a22be819d
1 changed files with 15 additions and 10 deletions
|
@ -12,17 +12,15 @@ namespace Mist {
|
||||||
initialize();
|
initialize();
|
||||||
std::string tracks = config->getString("tracks");
|
std::string tracks = config->getString("tracks");
|
||||||
if (config->getString("target").size()){
|
if (config->getString("target").size()){
|
||||||
std::string target = config->getString("target");
|
HTTP::URL target(config->getString("target"));
|
||||||
if (target.substr(0,8) != "tsudp://"){
|
if (target.protocol != "tsudp"){
|
||||||
FAIL_MSG("Target %s must begin with tsudp://, aborting", target.c_str());
|
FAIL_MSG("Target %s must begin with tsudp://, aborting", target.getUrl().c_str());
|
||||||
parseData = false;
|
parseData = false;
|
||||||
myConn.close();
|
myConn.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//strip beginning off URL
|
if (!target.getPort()){
|
||||||
target.erase(0, 8);
|
FAIL_MSG("Target %s must contain a port, aborting", target.getUrl().c_str());
|
||||||
if (target.find(':') == std::string::npos){
|
|
||||||
FAIL_MSG("Target %s must contain a port, aborting", target.c_str());
|
|
||||||
parseData = false;
|
parseData = false;
|
||||||
myConn.close();
|
myConn.close();
|
||||||
return;
|
return;
|
||||||
|
@ -32,9 +30,16 @@ namespace Mist {
|
||||||
if (targetParams.count("tracks")){tracks = targetParams["tracks"];}
|
if (targetParams.count("tracks")){tracks = targetParams["tracks"];}
|
||||||
if (targetParams.count("pkts")){udpSize = atoi(targetParams["pkts"].c_str());}
|
if (targetParams.count("pkts")){udpSize = atoi(targetParams["pkts"].c_str());}
|
||||||
packetBuffer.reserve(188*udpSize);
|
packetBuffer.reserve(188*udpSize);
|
||||||
int port = atoi(target.substr(target.find(":") + 1).c_str());
|
if (target.path.size()){
|
||||||
target.erase(target.find(":"));//strip all after the colon
|
if (!pushSock.bind(0, target.path)){
|
||||||
pushSock.SetDestination(target, port);
|
disconnect();
|
||||||
|
streamName = "";
|
||||||
|
selectedTracks.clear();
|
||||||
|
config->is_active = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pushSock.SetDestination(target.host, target.getPort());
|
||||||
}
|
}
|
||||||
unsigned int currTrack = 0;
|
unsigned int currTrack = 0;
|
||||||
//loop over tracks, add any found track IDs to selectedTracks
|
//loop over tracks, add any found track IDs to selectedTracks
|
||||||
|
|
Loading…
Add table
Reference in a new issue