diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/RTPPayloadTypeParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/RTPPayloadTypeParser.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Swiften/Parser/PayloadParsers/RTPPayloadTypeParser.cpp b/Swiften/Parser/PayloadParsers/RTPPayloadTypeParser.cpp index 56fe109..f9d9bb3 100644 --- a/Swiften/Parser/PayloadParsers/RTPPayloadTypeParser.cpp +++ b/Swiften/Parser/PayloadParsers/RTPPayloadTypeParser.cpp @@ -8,9 +8,7 @@ #include <boost/optional.hpp> #include <boost/lexical_cast.hpp> - -//#include <Swiften/Base/DateTime.h> -//#include <Swiften/Base/Log.h> +#include <boost/numeric/conversion/cast.hpp> namespace Swift { @@ -20,7 +18,7 @@ RTPPayloadTypeParser::RTPPayloadTypeParser() : level(0) { void RTPPayloadTypeParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level == 0) { - // channel + // channels try { getPayloadInternal()->setChannels(boost::lexical_cast<boost::uint32_t>(attributes.getAttributeValue("channels").get_value_or("1"))); } catch (boost::bad_lexical_cast &) { @@ -34,9 +32,9 @@ void RTPPayloadTypeParser::handleStartElement(const std::string& element, const } // ID try { - getPayloadInternal()->setID(boost::lexical_cast<boost::uint8_t>(attributes.getAttributeValue("id").get_value_or("0"))); + getPayloadInternal()->setID(boost::numeric_cast<boost::uint8_t>(boost::lexical_cast<int>(attributes.getAttributeValue("id").get_value_or("0")))); } catch (boost::bad_lexical_cast &) { - getPayloadInternal()->setID(0); + getPayloadInternal()->setID(151); } // maxptime try { @@ -52,14 +50,14 @@ void RTPPayloadTypeParser::handleStartElement(const std::string& element, const } catch (boost::bad_lexical_cast &) { getPayloadInternal()->setPTime(0); } - } else if (level == 1) { + } else if (level == 1 && element == "parameter") { getPayloadInternal()->addParameter(attributes.getAttributeValue("name").get_value_or(""), attributes.getAttributeValue("value").get_value_or("")); } ++level; } -void RTPPayloadTypeParser::handleEndElement(const std::string& element, const std::string&) { +void RTPPayloadTypeParser::handleEndElement(const std::string&, const std::string&) { --level; } |