aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppRtpChannel.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2015-08-19 18:02:59 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2015-08-19 18:02:59 +0200
commit2b538aecb57dec32aacc27c8f23fd377b03991d4 (patch)
treeb0f17eab97192f5ae3e3acbf43f1e8a1b35cdfd0 /src/base/QXmppRtpChannel.cpp
parent2ecdd17e4e273d4385113b6742a86e98153413e2 (diff)
downloadqxmpp-2b538aecb57dec32aacc27c8f23fd377b03991d4.tar.gz
QXmppRtpChannel: make it possible to get / set the local SSRC
Diffstat (limited to 'src/base/QXmppRtpChannel.cpp')
-rw-r--r--src/base/QXmppRtpChannel.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/base/QXmppRtpChannel.cpp b/src/base/QXmppRtpChannel.cpp
index 7c093192..59f18287 100644
--- a/src/base/QXmppRtpChannel.cpp
+++ b/src/base/QXmppRtpChannel.cpp
@@ -121,6 +121,7 @@ QString QXmppRtpPacket::toString() const
QXmppRtpChannel::QXmppRtpChannel()
: m_outgoingPayloadNumbered(false)
{
+ m_outgoingSsrc = qrand();
}
/// Returns the local payload types.
@@ -167,6 +168,23 @@ void QXmppRtpChannel::setRemotePayloadTypes(const QList<QXmppJinglePayloadType>
payloadTypesChanged();
}
+/// Returns the local SSRC.
+
+quint32 QXmppRtpChannel::localSsrc() const
+{
+ return m_outgoingSsrc;
+}
+
+/// Sets the local SSRC.
+///
+/// \param ssrc
+
+void QXmppRtpChannel::setLocalSsrc(quint32 ssrc)
+{
+ m_outgoingSsrc = ssrc;
+}
+
+
enum CodecId {
G711u = 0,
GSM = 3,
@@ -260,7 +278,6 @@ public:
QList<ToneInfo> outgoingTones;
QXmppJinglePayloadType outgoingTonesType;
- quint32 outgoingSsrc;
QXmppJinglePayloadType payloadType;
private:
@@ -281,11 +298,9 @@ QXmppRtpAudioChannelPrivate::QXmppRtpAudioChannelPrivate(QXmppRtpAudioChannel *q
outgoingSequence(1),
outgoingStamp(0),
outgoingTimer(0),
- outgoingSsrc(0),
q(qq)
{
qRegisterMetaType<QXmppRtpAudioChannel::Tone>("QXmppRtpAudioChannel::Tone");
- outgoingSsrc = qrand();
}
/// Returns the audio codec for the given payload type.
@@ -688,7 +703,7 @@ void QXmppRtpAudioChannel::writeDatagram()
packet.type = d->outgoingTonesType.id();
packet.sequence = d->outgoingSequence;
packet.stamp = info.outgoingStart;
- packet.ssrc = d->outgoingSsrc;
+ packet.ssrc = localSsrc();
QDataStream output(&packet.payload, QIODevice::WriteOnly);
output << quint8(info.tone);
@@ -726,7 +741,7 @@ void QXmppRtpAudioChannel::writeDatagram()
packet.type = d->payloadType.id();
packet.sequence = d->outgoingSequence;
packet.stamp = d->outgoingStamp;
- packet.ssrc = d->outgoingSsrc;
+ packet.ssrc = localSsrc();
// encode audio chunk
QDataStream input(chunk);
@@ -856,17 +871,14 @@ public:
quint8 outgoingId;
quint16 outgoingSequence;
quint32 outgoingStamp;
- quint32 outgoingSsrc;
};
QXmppRtpVideoChannelPrivate::QXmppRtpVideoChannelPrivate()
: encoder(0),
outgoingId(0),
outgoingSequence(1),
- outgoingStamp(0),
- outgoingSsrc(0)
+ outgoingStamp(0)
{
- outgoingSsrc = qrand();
}
/// Constructs a new RTP video channel with the given \a parent.
@@ -1057,7 +1069,7 @@ void QXmppRtpVideoChannel::writeFrame(const QXmppVideoFrame &frame)
packet.version = RTP_VERSION;
packet.marker = false;
packet.type = d->outgoingId;
- packet.ssrc = d->outgoingSsrc;
+ packet.ssrc = localSsrc();
foreach (const QByteArray &payload, d->encoder->handleFrame(frame)) {
packet.sequence = d->outgoingSequence++;
packet.stamp = d->outgoingStamp;