RTSP input fixes
This commit is contained in:
parent
8ba7baea98
commit
431fecb67b
2 changed files with 21 additions and 8 deletions
|
@ -102,7 +102,7 @@ namespace Mist{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sndH.SendRequest(tcpCon, "", true);
|
sndH.SendRequest(tcpCon, "", true);
|
||||||
parsePacket();
|
parsePacket(true);
|
||||||
|
|
||||||
if (reAuth && needAuth && authRequest.size() && (username.size() || password.size()) && tcpCon){
|
if (reAuth && needAuth && authRequest.size() && (username.size() || password.size()) && tcpCon){
|
||||||
INFO_MSG("Authenticating %s...", cmd.c_str());
|
INFO_MSG("Authenticating %s...", cmd.c_str());
|
||||||
|
@ -150,17 +150,30 @@ namespace Mist{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sdpState.tracks.size()){
|
if (sdpState.tracks.size()){
|
||||||
|
bool atLeastOne = false;
|
||||||
for (std::map<uint32_t, SDP::Track>::iterator it = sdpState.tracks.begin();
|
for (std::map<uint32_t, SDP::Track>::iterator it = sdpState.tracks.begin();
|
||||||
it != sdpState.tracks.end(); ++it){
|
it != sdpState.tracks.end(); ++it){
|
||||||
transportSet = false;
|
transportSet = false;
|
||||||
extraHeaders.clear();
|
extraHeaders.clear();
|
||||||
extraHeaders["Transport"] = it->second.generateTransport(it->first, url.host, TCPmode);
|
extraHeaders["Transport"] = it->second.generateTransport(it->first, url.host, TCPmode);
|
||||||
sendCommand("SETUP", HTTP::URL(url.getUrl()+"/").link(it->second.control).getUrl(), "", &extraHeaders);
|
sendCommand("SETUP", HTTP::URL(url.getUrl()+"/").link(it->second.control).getUrl(), "", &extraHeaders);
|
||||||
if (!tcpCon || !transportSet){
|
if (tcpCon && transportSet){
|
||||||
FAIL_MSG("Could not setup track %s!", myMeta.tracks[it->first].getIdentifier().c_str());
|
atLeastOne = true;
|
||||||
tcpCon.close();
|
continue;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
if (!atLeastOne && tcpCon){
|
||||||
|
INFO_MSG("Failed to set up transport for track %s, switching transports...", myMeta.tracks[it->first].getIdentifier().c_str());
|
||||||
|
TCPmode = !TCPmode;
|
||||||
|
extraHeaders["Transport"] = it->second.generateTransport(it->first, url.host, TCPmode);
|
||||||
|
sendCommand("SETUP", HTTP::URL(url.getUrl()+"/").link(it->second.control).getUrl(), "", &extraHeaders);
|
||||||
|
}
|
||||||
|
if (tcpCon && transportSet){
|
||||||
|
atLeastOne = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
FAIL_MSG("Could not setup track %s!", myMeta.tracks[it->first].getIdentifier().c_str());
|
||||||
|
tcpCon.close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INFO_MSG("Setup complete");
|
INFO_MSG("Setup complete");
|
||||||
|
@ -224,7 +237,7 @@ namespace Mist{
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputRTSP::parsePacket(){
|
bool InputRTSP::parsePacket(bool mustHave){
|
||||||
uint32_t waitTime = 500;
|
uint32_t waitTime = 500;
|
||||||
if (!TCPmode){waitTime = 50;}
|
if (!TCPmode){waitTime = 50;}
|
||||||
do{
|
do{
|
||||||
|
@ -233,7 +246,7 @@ namespace Mist{
|
||||||
if (!tcpCon.spool() && tcpCon && config->is_active && nProxy.userClient.isAlive()){
|
if (!tcpCon.spool() && tcpCon && config->is_active && nProxy.userClient.isAlive()){
|
||||||
nProxy.userClient.keepAlive();
|
nProxy.userClient.keepAlive();
|
||||||
Util::sleep(waitTime);
|
Util::sleep(waitTime);
|
||||||
if (!TCPmode){return true;}
|
if (!mustHave){return tcpCon;}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Mist{
|
||||||
void seek(int seekTime){}
|
void seek(int seekTime){}
|
||||||
void sendCommand(const std::string &cmd, const std::string &cUrl, const std::string &body,
|
void sendCommand(const std::string &cmd, const std::string &cUrl, const std::string &body,
|
||||||
const std::map<std::string, std::string> *extraHeaders = 0, bool reAuth=true);
|
const std::map<std::string, std::string> *extraHeaders = 0, bool reAuth=true);
|
||||||
bool parsePacket();
|
bool parsePacket(bool mustHave = false);
|
||||||
bool handleUDP();
|
bool handleUDP();
|
||||||
std::string streamMainLoop();
|
std::string streamMainLoop();
|
||||||
Socket::Connection tcpCon;
|
Socket::Connection tcpCon;
|
||||||
|
|
Loading…
Add table
Reference in a new issue