diff --git a/src/input/input_rtsp.cpp b/src/input/input_rtsp.cpp index 4959ab35..db0090a4 100755 --- a/src/input/input_rtsp.cpp +++ b/src/input/input_rtsp.cpp @@ -79,7 +79,7 @@ namespace Mist{ void InputRTSP::sendCommand(const std::string &cmd, const std::string &cUrl, const std::string &body, - const std::map &extraHeaders){ + const std::map *extraHeaders){ ++cSeq; sndH.Clean(); sndH.protocol = "RTSP/1.0"; @@ -92,9 +92,9 @@ namespace Mist{ sndH.SetHeader("User-Agent", "MistServer " PACKAGE_VERSION); sndH.SetHeader("CSeq", JSON::Value((long long)cSeq).asString()); if (session.size()){sndH.SetHeader("Session", session);} - if (extraHeaders.size()){ - for (std::map::const_iterator it = extraHeaders.begin(); - it != extraHeaders.end(); ++it){ + if (extraHeaders && extraHeaders->size()){ + for (std::map::const_iterator it = extraHeaders->begin(); + it != extraHeaders->end(); ++it){ sndH.SetHeader(it->first, it->second); } } @@ -130,11 +130,11 @@ namespace Mist{ void InputRTSP::parseStreamHeader(){ std::map extraHeaders; extraHeaders["Accept"] = "application/sdp"; - sendCommand("DESCRIBE", url.getUrl(), "", extraHeaders); + sendCommand("DESCRIBE", url.getUrl(), "", &extraHeaders); parsePacket(); if (!seenSDP && authRequest.size() && (username.size() || password.size()) && tcpCon){ INFO_MSG("Authenticating..."); - sendCommand("DESCRIBE", url.getUrl(), "", extraHeaders); + sendCommand("DESCRIBE", url.getUrl(), "", &extraHeaders); parsePacket(); } if (!tcpCon || !seenSDP){ @@ -147,7 +147,7 @@ namespace Mist{ transportSet = false; extraHeaders.clear(); extraHeaders["Transport"] = it->second.generateTransport(it->first, url.host, TCPmode); - sendCommand("SETUP", url.link(it->second.control).getUrl(), "", extraHeaders); + sendCommand("SETUP", url.link(it->second.control).getUrl(), "", &extraHeaders); parsePacket(); if (!tcpCon || !transportSet){ FAIL_MSG("Could not setup track %s!", myMeta.tracks[it->first].getIdentifier().c_str()); @@ -159,7 +159,7 @@ namespace Mist{ INFO_MSG("Setup complete"); extraHeaders.clear(); extraHeaders["Range"] = "npt=0.000-"; - sendCommand("PLAY", url.getUrl(), "", extraHeaders); + sendCommand("PLAY", url.getUrl(), "", &extraHeaders); if (!TCPmode){ tcpCon.setBlocking(false); connectedAt = Util::epoch() + 2208988800ll; diff --git a/src/input/input_rtsp.h b/src/input/input_rtsp.h index c2d63c0f..6ce16ecf 100755 --- a/src/input/input_rtsp.h +++ b/src/input/input_rtsp.h @@ -26,8 +26,7 @@ namespace Mist{ void parseStreamHeader(); void seek(int seekTime){} void sendCommand(const std::string &cmd, const std::string &cUrl, const std::string &body, - const std::map &extraHeaders = - std::map()); + const std::map *extraHeaders = 0); bool parsePacket(); bool handleUDP(); std::string streamMainLoop();