aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Csötönyi <work@taibsu.de>2023-05-03 15:26:55 +0200
committerLinus Jahn <lnj@kaidan.im>2023-05-14 23:51:42 +0200
commit4d0aaabef3d2458e622e61170f3fcb8d80092aee (patch)
treedd496c4dcf33f55e1e7ae39931edeeab0753bdea
parentfbb96a37f1c118c14fd158173e0d691022183ee3 (diff)
Extract JingleIq::Description to own class
Description will be used by JingleMessageInitiationElement as well
-rw-r--r--src/base/QXmppJingleIq.cpp217
-rw-r--r--src/base/QXmppJingleIq.h41
-rw-r--r--tests/qxmppjingleiq/tst_qxmppjingleiq.cpp121
3 files changed, 255 insertions, 124 deletions
diff --git a/src/base/QXmppJingleIq.cpp b/src/base/QXmppJingleIq.cpp
index a89f87a6..e3022dcc 100644
--- a/src/base/QXmppJingleIq.cpp
+++ b/src/base/QXmppJingleIq.cpp
@@ -224,9 +224,7 @@ public:
QString name;
QString senders;
- QString descriptionMedia;
- quint32 descriptionSsrc;
- QString descriptionType;
+ QXmppJingleDescription description;
bool isRtpMultiplexingSupported = false;
QString transportType;
@@ -237,7 +235,6 @@ public:
QString transportFingerprintHash;
QString transportFingerprintSetup;
- QList<QXmppJinglePayloadType> payloadTypes;
QList<QXmppJingleCandidate> transportCandidates;
// XEP-0167: Jingle RTP Sessions
@@ -253,8 +250,8 @@ public:
};
QXmppJingleIqContentPrivate::QXmppJingleIqContentPrivate()
- : descriptionSsrc(0)
{
+ description.setSsrc(0);
}
///
@@ -362,36 +359,20 @@ void QXmppJingleIq::Content::setSenders(const QString &senders)
d->senders = senders;
}
-QString QXmppJingleIq::Content::descriptionMedia() const
-{
- return d->descriptionMedia;
-}
-
-void QXmppJingleIq::Content::setDescriptionMedia(const QString &media)
-{
- d->descriptionMedia = media;
-}
-
///
-/// Returns the description's 32-bit synchronization source for the media stream as specified by
+/// Returns the description as specified by
/// \xep{0167, Jingle RTP Sessions} and RFC 3550.
///
/// \since QXmpp 0.9
///
-quint32 QXmppJingleIq::Content::descriptionSsrc() const
+QXmppJingleDescription QXmppJingleIq::Content::description() const
{
- return d->descriptionSsrc;
+ return d->description;
}
-///
-/// Sets the description's 32-bit synchronization source for the media stream as specified by
-/// \xep{0167, Jingle RTP Sessions} and RFC 3550.
-///
-/// \since QXmpp 0.9
-///
-void QXmppJingleIq::Content::setDescriptionSsrc(quint32 ssrc)
+void QXmppJingleIq::Content::setDescription(const QXmppJingleDescription &description)
{
- d->descriptionSsrc = ssrc;
+ d->description = description;
}
///
@@ -446,23 +427,6 @@ void QXmppJingleIq::Content::setRtpEncryption(const std::optional<QXmppJingleRtp
d->rtpEncryption = rtpEncryption;
}
-void QXmppJingleIq::Content::addPayloadType(const QXmppJinglePayloadType &payload)
-{
- d->descriptionType = ns_jingle_rtp;
- d->payloadTypes << payload;
-}
-
-QList<QXmppJinglePayloadType> QXmppJingleIq::Content::payloadTypes() const
-{
- return d->payloadTypes;
-}
-
-void QXmppJingleIq::Content::setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes)
-{
- d->descriptionType = payloadTypes.isEmpty() ? QString() : ns_jingle_rtp;
- d->payloadTypes = payloadTypes;
-}
-
void QXmppJingleIq::Content::addTransportCandidate(const QXmppJingleCandidate &candidate)
{
d->transportType = ns_jingle_ice_udp;
@@ -687,9 +651,9 @@ void QXmppJingleIq::Content::parse(const QDomElement &element)
// description
QDomElement descriptionElement = element.firstChildElement(QStringLiteral("description"));
- d->descriptionType = descriptionElement.namespaceURI();
- d->descriptionMedia = descriptionElement.attribute(QStringLiteral("media"));
- d->descriptionSsrc = descriptionElement.attribute(QStringLiteral("ssrc")).toULong();
+ d->description.setType(descriptionElement.namespaceURI());
+ d->description.setMedia(descriptionElement.attribute(QStringLiteral("media")));
+ d->description.setSsrc(descriptionElement.attribute(QStringLiteral("ssrc")).toULong());
d->isRtpMultiplexingSupported = !descriptionElement.firstChildElement(QStringLiteral("rtcp-mux")).isNull();
for (auto childElement = descriptionElement.firstChildElement();
@@ -710,7 +674,7 @@ void QXmppJingleIq::Content::parse(const QDomElement &element)
while (!child.isNull()) {
QXmppJinglePayloadType payload;
payload.parse(child);
- d->payloadTypes << payload;
+ d->description.addPayloadType(payload);
child = child.nextSiblingElement(QStringLiteral("payload-type"));
}
@@ -749,13 +713,13 @@ void QXmppJingleIq::Content::toXml(QXmlStreamWriter *writer) const
helperToXmlAddAttribute(writer, QStringLiteral("senders"), d->senders);
// description
- if (!d->descriptionType.isEmpty() || !d->payloadTypes.isEmpty()) {
+ if (!d->description.type().isEmpty() || !d->description.payloadTypes().isEmpty()) {
writer->writeStartElement(QStringLiteral("description"));
- writer->writeDefaultNamespace(d->descriptionType);
- helperToXmlAddAttribute(writer, QStringLiteral("media"), d->descriptionMedia);
+ writer->writeDefaultNamespace(d->description.type());
+ helperToXmlAddAttribute(writer, QStringLiteral("media"), d->description.media());
- if (d->descriptionSsrc) {
- writer->writeAttribute(QStringLiteral("ssrc"), QString::number(d->descriptionSsrc));
+ if (d->description.ssrc()) {
+ writer->writeAttribute(QStringLiteral("ssrc"), QString::number(d->description.ssrc()));
}
if (d->isRtpMultiplexingSupported) {
@@ -769,7 +733,7 @@ void QXmppJingleIq::Content::toXml(QXmlStreamWriter *writer) const
jingleRtpFeedbackNegotiationElementsToXml(writer, d->rtpFeedbackProperties, d->rtpFeedbackIntervals);
jingleRtpHeaderExtensionsNegotiationElementsToXml(writer, d->rtpHeaderExtensionProperties, d->isRtpHeaderExtensionMixingAllowed);
- for (const auto &payload : d->payloadTypes) {
+ for (const auto &payload : d->description.payloadTypes()) {
payload.toXml(writer);
}
@@ -888,7 +852,7 @@ bool QXmppJingleIq::Content::parseSdp(const QString &sdp)
qWarning() << "Could not parse ssrc" << line;
return false;
}
- d->descriptionSsrc = bits[0].toULong();
+ d->description.setSsrc(bits[0].toULong());
}
} else if (line.startsWith(QStringLiteral("m="))) {
// FIXME: what do we do with the profile (bits[2]) ?
@@ -897,7 +861,7 @@ bool QXmppJingleIq::Content::parseSdp(const QString &sdp)
qWarning() << "Could not parse media" << line;
return false;
}
- d->descriptionMedia = bits[0];
+ d->description.setMedia(bits[0]);
// parse payload types
for (int i = 3; i < bits.size(); ++i) {
@@ -912,7 +876,8 @@ bool QXmppJingleIq::Content::parseSdp(const QString &sdp)
}
}
}
- setPayloadTypes(payloads);
+
+ d->description.setPayloadTypes(payloads);
return true;
}
@@ -945,7 +910,7 @@ QString QXmppJingleIq::Content::toSdp() const
// media
QString payloads;
QStringList attrs;
- for (const QXmppJinglePayloadType &payload : d->payloadTypes) {
+ for (const QXmppJinglePayloadType &payload : d->description.payloadTypes()) {
payloads += " " + QString::number(payload.id());
QString rtpmap = QString::number(payload.id()) + " " + payload.name() + "/" + QString::number(payload.clockrate());
if (payload.channels() > 1) {
@@ -970,7 +935,7 @@ QString QXmppJingleIq::Content::toSdp() const
attrs << QStringLiteral("a=fmtp:") + QByteArray::number(payload.id()) + QStringLiteral(" ") + paramList.join("; ");
}
}
- sdp << QStringLiteral("m=%1 %2 RTP/AVP%3").arg(d->descriptionMedia, QString::number(localRtpPort), payloads);
+ sdp << QStringLiteral("m=%1 %2 RTP/AVP%3").arg(d->description.media(), QString::number(localRtpPort), payloads);
sdp << QStringLiteral("c=%1").arg(addressToSdp(localRtpAddress));
sdp += attrs;
@@ -2056,6 +2021,142 @@ bool QXmppJinglePayloadType::operator==(const QXmppJinglePayloadType &other) con
}
}
+class QXmppJingleDescriptionPrivate : public QSharedData
+{
+public:
+ QXmppJingleDescriptionPrivate() = default;
+
+ QString media;
+ quint32 ssrc;
+ QString type;
+ QList<QXmppJinglePayloadType> payloadTypes;
+};
+
+///
+/// \class QXmppJingleDescription
+///
+/// \brief The QXmppJingleDescription class represents descriptions for Jingle elements including
+/// media type, streaming source, namespace and payload types.
+///
+/// \since QXmpp 1.6
+///
+
+QXmppJingleDescription::QXmppJingleDescription()
+ : d(new QXmppJingleDescriptionPrivate())
+{
+}
+
+QXMPP_PRIVATE_DEFINE_RULE_OF_SIX(QXmppJingleDescription)
+
+///
+/// Returns the media type.
+///
+QString QXmppJingleDescription::media() const
+{
+ return d->media;
+}
+
+///
+/// Sets the media type.
+///
+void QXmppJingleDescription::setMedia(const QString &media)
+{
+ d->media = media;
+}
+
+///
+/// Returns the streaming source.
+///
+quint32 QXmppJingleDescription::ssrc() const
+{
+ return d->ssrc;
+}
+
+///
+/// Sets the streaming source.
+///
+void QXmppJingleDescription::setSsrc(quint32 ssrc)
+{
+ d->ssrc = ssrc;
+}
+
+///
+/// Returns the description namespace.
+///
+QString QXmppJingleDescription::type() const
+{
+ return d->type;
+}
+
+///
+/// Sets the description namespace.
+///
+void QXmppJingleDescription::setType(const QString &type)
+{
+ d->type = type;
+}
+
+///
+/// Adds a payload type to the list of payload types.
+///
+void QXmppJingleDescription::addPayloadType(const QXmppJinglePayloadType &payload)
+{
+ d->type = ns_jingle_rtp;
+ d->payloadTypes.append(payload);
+}
+
+///
+/// Returns a list of payload types.
+///
+const QList<QXmppJinglePayloadType> &QXmppJingleDescription::payloadTypes() const
+{
+ return d->payloadTypes;
+}
+
+///
+/// Sets the list of payload types.
+///
+void QXmppJingleDescription::setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes)
+{
+ d->type = payloadTypes.isEmpty() ? QString() : ns_jingle_rtp;
+ d->payloadTypes = payloadTypes;
+}
+
+/// \cond
+void QXmppJingleDescription::parse(const QDomElement &element)
+{
+ d->type = element.namespaceURI();
+ d->media = element.attribute(QStringLiteral("media"));
+ d->ssrc = element.attribute(QStringLiteral("ssrc")).toULong();
+
+ QDomElement child { element.firstChildElement(QStringLiteral("payload-type")) };
+ while (!child.isNull()) {
+ QXmppJinglePayloadType payload;
+ payload.parse(child);
+ d->payloadTypes.append(payload);
+ child = child.nextSiblingElement(QStringLiteral("payload-type"));
+ }
+}
+
+void QXmppJingleDescription::toXml(QXmlStreamWriter *writer) const
+{
+ writer->writeStartElement(QStringLiteral("description"));
+ writer->writeDefaultNamespace(d->type);
+
+ helperToXmlAddAttribute(writer, QStringLiteral("media"), d->media);
+
+ if (d->ssrc) {
+ writer->writeAttribute(QStringLiteral("ssrc"), QString::number(d->ssrc));
+ }
+
+ for (const auto &payloadType : d->payloadTypes) {
+ payloadType.toXml(writer);
+ }
+
+ writer->writeEndElement();
+}
+/// \endcond
+
class QXmppSdpParameterPrivate : public QSharedData
{
public:
diff --git a/src/base/QXmppJingleIq.h b/src/base/QXmppJingleIq.h
index f5da136c..20a827ba 100644
--- a/src/base/QXmppJingleIq.h
+++ b/src/base/QXmppJingleIq.h
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2010 Jeremy Lainé <jeremy.laine@m4x.org>
// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
+// SPDX-FileCopyrightText: 2023 Tibor Csötönyi <work@taibsu.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
@@ -13,6 +14,7 @@
#include <QHostAddress>
class QXmppJingleCandidatePrivate;
+class QXmppJingleDescriptionPrivate;
class QXmppJingleIqContentPrivate;
class QXmppJingleIqPrivate;
class QXmppJinglePayloadTypePrivate;
@@ -237,6 +239,34 @@ private:
QSharedDataPointer<QXmppJinglePayloadTypePrivate> d;
};
+class QXMPP_EXPORT QXmppJingleDescription
+{
+public:
+ QXmppJingleDescription();
+ QXMPP_PRIVATE_DECLARE_RULE_OF_SIX(QXmppJingleDescription)
+
+ QString media() const;
+ void setMedia(const QString &media);
+
+ quint32 ssrc() const;
+ void setSsrc(quint32 ssrc);
+
+ QString type() const;
+ void setType(const QString &type);
+
+ void addPayloadType(const QXmppJinglePayloadType &payload);
+ const QList<QXmppJinglePayloadType> &payloadTypes() const;
+ void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
+
+ /// \cond
+ void parse(const QDomElement &element);
+ void toXml(QXmlStreamWriter *writer) const;
+ /// \endcond
+
+private:
+ QSharedDataPointer<QXmppJingleDescriptionPrivate> d;
+};
+
///
/// \brief The QXmppJingleCandidate class represents a transport candidate
/// as specified by \xep{0176}: Jingle ICE-UDP Transport Method.
@@ -397,11 +427,8 @@ public:
void setSenders(const QString &senders);
// XEP-0167: Jingle RTP Sessions
- QString descriptionMedia() const;
- void setDescriptionMedia(const QString &media);
-
- quint32 descriptionSsrc() const;
- void setDescriptionSsrc(quint32 ssrc);
+ QXmppJingleDescription description() const;
+ void setDescription(const QXmppJingleDescription &description);
bool isRtpMultiplexingSupported() const;
void setRtpMultiplexingSupported(bool isRtpMultiplexingSupported);
@@ -409,10 +436,6 @@ public:
std::optional<QXmppJingleRtpEncryption> rtpEncryption() const;
void setRtpEncryption(const std::optional<QXmppJingleRtpEncryption> &rtpEncryption);
- void addPayloadType(const QXmppJinglePayloadType &payload);
- QList<QXmppJinglePayloadType> payloadTypes() const;
- void setPayloadTypes(const QList<QXmppJinglePayloadType> &payloadTypes);
-
void addTransportCandidate(const QXmppJingleCandidate &candidate);
QList<QXmppJingleCandidate> transportCandidates() const;
void setTransportCandidates(const QList<QXmppJingleCandidate> &candidates);
diff --git a/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp b/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp
index b27d7454..bb4e7ba1 100644
--- a/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp
+++ b/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2012 Jeremy Lainé <jeremy.laine@m4x.org>
// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de>
+// SPDX-FileCopyrightText: 2023 Tibor Csötönyi <work@taibsu.de>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
@@ -613,11 +614,11 @@ void tst_QXmppJingleIq::testContent()
QXmppJingleIq::Content content1;
QVERIFY(content1.creator().isEmpty());
QVERIFY(content1.name().isEmpty());
- QVERIFY(content1.descriptionMedia().isEmpty());
- QCOMPARE(content1.descriptionSsrc(), quint32(0));
+ QVERIFY(content1.description().media().isEmpty());
+ QCOMPARE(content1.description().ssrc(), quint32(0));
QVERIFY(!content1.isRtpMultiplexingSupported());
QVERIFY(!content1.rtpEncryption());
- QCOMPARE(content1.payloadTypes().size(), 0);
+ QCOMPARE(content1.description().payloadTypes().size(), 0);
QVERIFY(content1.transportUser().isEmpty());
QVERIFY(content1.transportPassword().isEmpty());
QCOMPARE(content1.transportCandidates().size(), 0);
@@ -625,13 +626,13 @@ void tst_QXmppJingleIq::testContent()
QCOMPARE(content1.creator(), QStringLiteral("initiator"));
QCOMPARE(content1.name(), QStringLiteral("voice"));
- QCOMPARE(content1.descriptionMedia(), QStringLiteral("audio"));
- QCOMPARE(content1.descriptionSsrc(), quint32(0));
+ QCOMPARE(content1.description().media(), QStringLiteral("audio"));
+ QCOMPARE(content1.description().ssrc(), quint32(0));
QVERIFY(content1.isRtpMultiplexingSupported());
QVERIFY(content1.rtpEncryption());
- QCOMPARE(content1.payloadTypes().size(), 2);
- QCOMPARE(content1.payloadTypes().at(0).id(), quint8(96));
- QCOMPARE(content1.payloadTypes().at(1).id(), quint8(97));
+ QCOMPARE(content1.description().payloadTypes().size(), 2);
+ QCOMPARE(content1.description().payloadTypes().at(0).id(), quint8(96));
+ QCOMPARE(content1.description().payloadTypes().at(1).id(), quint8(97));
QCOMPARE(content1.transportUser(), QStringLiteral("8hhy"));
QCOMPARE(content1.transportPassword(), QStringLiteral("asd88fgpdd777uzjYhagZg"));
QCOMPARE(content1.transportCandidates().size(), 2);
@@ -642,8 +643,9 @@ void tst_QXmppJingleIq::testContent()
QXmppJingleIq::Content content2;
content2.setCreator(QStringLiteral("initiator"));
content2.setName(QStringLiteral("voice"));
- content2.setDescriptionMedia(QStringLiteral("audio"));
- content2.setDescriptionSsrc(quint32(0));
+ QXmppJingleDescription content2desc;
+ content2desc.setMedia(QStringLiteral("audio"));
+ content2desc.setSsrc(quint32(0));
content2.setRtpMultiplexingSupported(true);
QXmppJingleRtpCryptoElement rtpCryptoElement;
rtpCryptoElement.setTag(1);
@@ -654,10 +656,11 @@ void tst_QXmppJingleIq::testContent()
content2.setRtpEncryption(rtpEncryption);
QXmppJinglePayloadType payloadType1;
payloadType1.setId(quint8(96));
- content2.setPayloadTypes({ payloadType1 });
+ content2desc.setPayloadTypes({ payloadType1 });
QXmppJinglePayloadType payloadType2;
payloadType2.setId(quint8(97));
- content2.addPayloadType(payloadType2);
+ content2desc.addPayloadType(payloadType2);
+ content2.setDescription(content2desc);
content2.setTransportUser(QStringLiteral("8hhy"));
content2.setTransportPassword(QStringLiteral("asd88fgpdd777uzjYhagZg"));
QXmppJingleCandidate transportCandidate1;
@@ -669,13 +672,13 @@ void tst_QXmppJingleIq::testContent()
QCOMPARE(content2.creator(), QStringLiteral("initiator"));
QCOMPARE(content2.name(), QStringLiteral("voice"));
- QCOMPARE(content2.descriptionMedia(), QStringLiteral("audio"));
- QCOMPARE(content2.descriptionSsrc(), quint32(0));
+ QCOMPARE(content2.description().media(), QStringLiteral("audio"));
+ QCOMPARE(content2.description().ssrc(), quint32(0));
QVERIFY(content2.isRtpMultiplexingSupported());
QVERIFY(content2.rtpEncryption());
- QCOMPARE(content2.payloadTypes().size(), 2);
- QCOMPARE(content2.payloadTypes().at(0).id(), quint8(96));
- QCOMPARE(content2.payloadTypes().at(1).id(), quint8(97));
+ QCOMPARE(content2.description().payloadTypes().size(), 2);
+ QCOMPARE(content2.description().payloadTypes().at(0).id(), quint8(96));
+ QCOMPARE(content2.description().payloadTypes().at(1).id(), quint8(97));
QCOMPARE(content2.transportUser(), QStringLiteral("8hhy"));
QCOMPARE(content2.transportPassword(), QStringLiteral("asd88fgpdd777uzjYhagZg"));
QCOMPARE(content2.transportCandidates().size(), 2);
@@ -715,10 +718,10 @@ void tst_QXmppJingleIq::testContentFingerprint()
QCOMPARE(content.creator(), QLatin1String("initiator"));
QCOMPARE(content.name(), QLatin1String("voice"));
- QCOMPARE(content.descriptionMedia(), QLatin1String("audio"));
- QCOMPARE(content.descriptionSsrc(), quint32(0));
- QCOMPARE(content.payloadTypes().size(), 1);
- QCOMPARE(content.payloadTypes()[0].id(), quint8(0));
+ QCOMPARE(content.description().media(), QLatin1String("audio"));
+ QCOMPARE(content.description().ssrc(), quint32(0));
+ QCOMPARE(content.description().payloadTypes().size(), 1);
+ QCOMPARE(content.description().payloadTypes()[0].id(), quint8(0));
QCOMPARE(content.transportCandidates().size(), 1);
QCOMPARE(content.transportCandidates()[0].component(), 1);
QCOMPARE(content.transportCandidates()[0].foundation(), QLatin1String("1"));
@@ -755,15 +758,15 @@ void tst_QXmppJingleIq::testContentSdp()
QXmppJingleIq::Content content;
QVERIFY(content.parseSdp(sdp));
- QCOMPARE(content.descriptionMedia(), QLatin1String("audio"));
- QCOMPARE(content.descriptionSsrc(), quint32(0));
- QCOMPARE(content.payloadTypes().size(), 6);
- QCOMPARE(content.payloadTypes()[0].id(), quint8(96));
- QCOMPARE(content.payloadTypes()[1].id(), quint8(97));
- QCOMPARE(content.payloadTypes()[2].id(), quint8(18));
- QCOMPARE(content.payloadTypes()[3].id(), quint8(0));
- QCOMPARE(content.payloadTypes()[4].id(), quint8(103));
- QCOMPARE(content.payloadTypes()[5].id(), quint8(98));
+ QCOMPARE(content.description().media(), QLatin1String("audio"));
+ QCOMPARE(content.description().ssrc(), quint32(0));
+ QCOMPARE(content.description().payloadTypes().size(), 6);
+ QCOMPARE(content.description().payloadTypes()[0].id(), quint8(96));
+ QCOMPARE(content.description().payloadTypes()[1].id(), quint8(97));
+ QCOMPARE(content.description().payloadTypes()[2].id(), quint8(18));
+ QCOMPARE(content.description().payloadTypes()[3].id(), quint8(0));
+ QCOMPARE(content.description().payloadTypes()[4].id(), quint8(103));
+ QCOMPARE(content.description().payloadTypes()[5].id(), quint8(98));
QCOMPARE(content.transportCandidates().size(), 2);
QCOMPARE(content.transportCandidates()[0].component(), 1);
QCOMPARE(content.transportCandidates()[0].foundation(), QLatin1String("1"));
@@ -804,15 +807,15 @@ void tst_QXmppJingleIq::testContentSdpReflexive()
QXmppJingleIq::Content content;
QVERIFY(content.parseSdp(sdp));
- QCOMPARE(content.descriptionMedia(), QLatin1String("audio"));
- QCOMPARE(content.descriptionSsrc(), quint32(0));
- QCOMPARE(content.payloadTypes().size(), 6);
- QCOMPARE(content.payloadTypes()[0].id(), quint8(96));
- QCOMPARE(content.payloadTypes()[1].id(), quint8(97));
- QCOMPARE(content.payloadTypes()[2].id(), quint8(18));
- QCOMPARE(content.payloadTypes()[3].id(), quint8(0));
- QCOMPARE(content.payloadTypes()[4].id(), quint8(103));
- QCOMPARE(content.payloadTypes()[5].id(), quint8(98));
+ QCOMPARE(content.description().media(), QLatin1String("audio"));
+ QCOMPARE(content.description().ssrc(), quint32(0));
+ QCOMPARE(content.description().payloadTypes().size(), 6);
+ QCOMPARE(content.description().payloadTypes()[0].id(), quint8(96));
+ QCOMPARE(content.description().payloadTypes()[1].id(), quint8(97));
+ QCOMPARE(content.description().payloadTypes()[2].id(), quint8(18));
+ QCOMPARE(content.description().payloadTypes()[3].id(), quint8(0));
+ QCOMPARE(content.description().payloadTypes()[4].id(), quint8(103));
+ QCOMPARE(content.description().payloadTypes()[5].id(), quint8(98));
QCOMPARE(content.transportCandidates().size(), 2);
QCOMPARE(content.transportCandidates()[0].component(), 1);
QCOMPARE(content.transportCandidates()[0].foundation(), QLatin1String("1"));
@@ -850,14 +853,14 @@ void tst_QXmppJingleIq::testContentSdpFingerprint()
QXmppJingleIq::Content content;
QVERIFY(content.parseSdp(sdp));
- QCOMPARE(content.descriptionMedia(), QLatin1String("audio"));
- QCOMPARE(content.descriptionSsrc(), quint32(0));
- QCOMPARE(content.payloadTypes().size(), 2);
- QCOMPARE(content.payloadTypes()[0].id(), quint8(96));
- QCOMPARE(content.payloadTypes()[0].parameters().value("vbr"), QLatin1String("on"));
- QCOMPARE(content.payloadTypes()[0].parameters().value("cng"), QLatin1String("on"));
- QCOMPARE(content.payloadTypes()[1].id(), quint8(100));
- QCOMPARE(content.payloadTypes()[1].parameters().value("events"), QLatin1String("0-15,66,70"));
+ QCOMPARE(content.description().media(), QLatin1String("audio"));
+ QCOMPARE(content.description().ssrc(), quint32(0));
+ QCOMPARE(content.description().payloadTypes().size(), 2);
+ QCOMPARE(content.description().payloadTypes()[0].id(), quint8(96));
+ QCOMPARE(content.description().payloadTypes()[0].parameters().value("vbr"), QLatin1String("on"));
+ QCOMPARE(content.description().payloadTypes()[0].parameters().value("cng"), QLatin1String("on"));
+ QCOMPARE(content.description().payloadTypes()[1].id(), quint8(100));
+ QCOMPARE(content.description().payloadTypes()[1].parameters().value("events"), QLatin1String("0-15,66,70"));
QCOMPARE(content.transportCandidates().size(), 1);
QCOMPARE(content.transportCandidates()[0].component(), 1);
QCOMPARE(content.transportCandidates()[0].foundation(), QLatin1String("1"));
@@ -887,14 +890,14 @@ void tst_QXmppJingleIq::testContentSdpParameters()
QXmppJingleIq::Content content;
QVERIFY(content.parseSdp(sdp));
- QCOMPARE(content.descriptionMedia(), QLatin1String("audio"));
- QCOMPARE(content.descriptionSsrc(), quint32(0));
- QCOMPARE(content.payloadTypes().size(), 2);
- QCOMPARE(content.payloadTypes()[0].id(), quint8(96));
- QCOMPARE(content.payloadTypes()[0].parameters().value("vbr"), QLatin1String("on"));
- QCOMPARE(content.payloadTypes()[0].parameters().value("cng"), QLatin1String("on"));
- QCOMPARE(content.payloadTypes()[1].id(), quint8(100));
- QCOMPARE(content.payloadTypes()[1].parameters().value("events"), QLatin1String("0-15,66,70"));
+ QCOMPARE(content.description().media(), QLatin1String("audio"));
+ QCOMPARE(content.description().ssrc(), quint32(0));
+ QCOMPARE(content.description().payloadTypes().size(), 2);
+ QCOMPARE(content.description().payloadTypes()[0].id(), quint8(96));
+ QCOMPARE(content.description().payloadTypes()[0].parameters().value("vbr"), QLatin1String("on"));
+ QCOMPARE(content.description().payloadTypes()[0].parameters().value("cng"), QLatin1String("on"));
+ QCOMPARE(content.description().payloadTypes()[1].id(), quint8(100));
+ QCOMPARE(content.description().payloadTypes()[1].parameters().value("events"), QLatin1String("0-15,66,70"));
QCOMPARE(content.transportCandidates().size(), 1);
QCOMPARE(content.transportCandidates()[0].component(), 1);
QCOMPARE(content.transportCandidates()[0].foundation(), QLatin1String("1"));
@@ -958,7 +961,9 @@ void tst_QXmppJingleIq::testContentRtpFeedbackNegotiation()
QXmppJingleIq::Content content2;
content2.setCreator(QStringLiteral("initiator"));
content2.setName(QStringLiteral("voice"));
- content2.addPayloadType(payloadType);
+ QXmppJingleDescription content2desc;
+ content2desc.addPayloadType(payloadType);
+ content2.setDescription(content2desc);
content2.setRtpFeedbackProperties({ rtpFeedbackProperty1, rtpFeedbackProperty2 });
content2.setRtpFeedbackIntervals({ rtpFeedbackInterval1, rtpFeedbackInterval2 });
@@ -1016,7 +1021,9 @@ void tst_QXmppJingleIq::testContentRtpHeaderExtensionsNegotiation()
QXmppJingleIq::Content content2;
content2.setCreator(QStringLiteral("initiator"));
content2.setName(QStringLiteral("voice"));
- content2.addPayloadType(payloadType);
+ QXmppJingleDescription content2desc;
+ content2desc.addPayloadType(payloadType);
+ content2.setDescription(content2desc);
content2.setRtpHeaderExtensionProperties({ rtpHeaderExtensionProperty1, rtpHeaderExtensionProperty2 });
content2.setRtpHeaderExtensionMixingAllowed(true);