summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Jingle/src/voip.cpp24
-rw-r--r--src/mir_core/src/tinyxml2_utils.cpp17
2 files changed, 21 insertions, 20 deletions
diff --git a/plugins/Jingle/src/voip.cpp b/plugins/Jingle/src/voip.cpp
index 8ca7eed036..e84b1ea01a 100644
--- a/plugins/Jingle/src/voip.cpp
+++ b/plugins/Jingle/src/voip.cpp
@@ -382,20 +382,18 @@ bool CJabberAccount::OnRTPDescription(const TiXmlElement *jingleNode)
CMStringA sdp_string(FORMAT, "v=0\r\no=- 0 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=ice-options:trickle\r\n"
"m=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:%s\r\na=ice-pwd:%s\r\na=rtcp-mux\r\na=sendrecv\r\na=rtpmap:111 OPUS/48000/2\r\n"
+ "a=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\n",
+ XmlGetAttr(transport, "ufrag"), XmlGetAttr(transport, "pwd"));
+
+ if (source) {
+ sdp_string.AppendFormat("a=ssrc:%s msid:%s\r\na=ssrc:%s cname:%s\r\n",
+ XmlGetAttr(source, "ssrc"),
+ XmlGetAttr(XmlGetChildByTag(source, "parameter", "name", "msid"), "value"),
+ XmlGetAttr(source, "ssrc"),
+ XmlGetAttr(XmlGetChildByTag(source, "parameter", "name", "cname"), "value"));
+ }
- "a=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\n"
- "a=ssrc:%s msid:%s\r\n"
- "a=ssrc:%s cname:%s\r\n"
-
- "a=mid:%s\r\na=setup:%s\r\na=fingerprint:sha-256 %s\r\na=rtcp-mux-only\r\n",
- XmlGetAttr(transport, "ufrag"),
- XmlGetAttr(transport, "pwd"),
-
- XmlGetAttr(source, "ssrc"),
- XmlGetAttr(XmlGetChildByTag(source, "parameter", "name", "msid"), "value"),
- XmlGetAttr(source, "ssrc"),
- XmlGetAttr(XmlGetChildByTag(source, "parameter", "name", "cname"), "value"),
-
+ sdp_string.AppendFormat("a=mid:%s\r\na=setup:%s\r\na=fingerprint:sha-256 %s\r\na=rtcp-mux-only\r\n",
XmlGetAttr(content, "name"),
XmlGetAttr(XmlFirstChild(transport, "fingerprint"), "setup"),
XmlFirstChild(transport, "fingerprint")->GetText());
diff --git a/src/mir_core/src/tinyxml2_utils.cpp b/src/mir_core/src/tinyxml2_utils.cpp
index 087e9d0230..c7351f16dc 100644
--- a/src/mir_core/src/tinyxml2_utils.cpp
+++ b/src/mir_core/src/tinyxml2_utils.cpp
@@ -71,9 +71,10 @@ MIR_CORE_DLL(int) XmlGetChildInt(const TiXmlElement *hXml, const char *key)
MIR_CORE_DLL(const TiXmlElement*) XmlGetChildByTag(const TiXmlElement *hXml, const char *key, const char *attrName, const char *attrValue)
{
- for (auto *pChild : TiXmlFilter(hXml, key))
- if (pChild->Attribute(attrName, attrValue))
- return pChild;
+ if (hXml)
+ for (auto *pChild : TiXmlFilter(hXml, key))
+ if (pChild->Attribute(attrName, attrValue))
+ return pChild;
return nullptr;
}
@@ -81,9 +82,11 @@ MIR_CORE_DLL(const TiXmlElement*) XmlGetChildByTag(const TiXmlElement *hXml, con
MIR_CORE_DLL(int) XmlGetChildCount(const TiXmlElement *hXml)
{
int iCount = 0;
- for (auto *it : TiXmlEnum(hXml)) {
- UNREFERENCED_PARAMETER(it);
- iCount++;
- }
+ if (hXml)
+ for (auto *it : TiXmlEnum(hXml)) {
+ UNREFERENCED_PARAMETER(it);
+ iCount++;
+ }
+
return iCount;
}