[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/soc-kopete-jingle/kopete/protocols/jabber
From: Detlev Casanova <detlev.casanova () gmail ! com>
Date: 2008-07-29 9:24:47
Message-ID: 1217323487.514112.20325.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 839011 by casanova:
* Rtp data in and out.
M +12 -1 jingle/jabberjinglecontent.cpp
M +1 -0 jingle/jabberjinglecontent.h
M +1 -1 jingle/jinglecallsmanager.cpp
M +1 -1 jingle/jinglemediamanager.cpp
M +34 -20 jingle/jinglertpsession.cpp
M +1 -0 jingle/jinglertpsession.h
M +6 -6 libiris/iris/jabber/jinglesession.cpp
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jabberjinglecontent.cpp \
#839010:839011 @@ -32,7 +32,7 @@
m_rtpOutSession = 0;
m_mediaManager = m_jabberSession->mediaManager();
if (!m_mediaManager)
- kDebug(KDE_DEFAULT_DEBUG_AREA) << "m_mediaManager is Null \
!!!!!!!!!!!!!!!!!!!!!!!!!!"; + kDebug(KDE_DEFAULT_DEBUG_AREA) << "m_mediaManager is \
Null !"; if (c == 0)
return;
@@ -75,6 +75,7 @@
}
m_rtpInSession->setRtpSocket(m_content->inSocket()); // This will set rtcp port = \
rtp port + 1. Maybe we don't want that for ice-udp. \
m_rtpInSession->setPayload(elementToSdp(bestPayload(m_content->payloadTypes(), \
m_mediaManager->payloads()))); + connect(m_rtpInSession, SIGNAL(readyRead(const \
QByteArray&)), this, SLOT(slotIncomingData(const QByteArray&))); }
}
@@ -93,6 +94,16 @@
}
}
+void JabberJingleSession::slotIncomingData(const QByteArray& data)
+{
+ /*
+ * TODO:
+ * Media manager should have a pointer to each JabberJingleSession
+ * so it knows what content it should expect for a given content/session.
+ */
+ m_mediaManager->processData();
+}
+
void JabberJingleContent::startWritingRtpData()
{
qDebug() << "Start Writing Rtp Data.";
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jabberjinglecontent.h \
#839010:839011 @@ -32,6 +32,7 @@
void slotSendRtpData();
void slotPrepareRtpInSession();
void slotPrepareRtpOutSession();
+ void slotIncomingData(const QByteArray&);
private:
XMPP::JingleContent *m_content;
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglecallsmanager.cpp \
#839010:839011 @@ -77,7 +77,7 @@
//Initialize oRTP library.
ortp_init();
- //ortp_scheduler_init(); // Check the utility of the scheduler.
+ ortp_scheduler_init();
d->gui = 0L;
QStringList transports;
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglemediamanager.cpp \
#839010:839011 @@ -94,6 +94,6 @@
QByteArray JingleMediaManager::data()
{
- return QByteArray("Data for 100 ms, you should not try to play this !!");
+ return QByteArray("Data for 2000 ms, you should not try to play this !!");
}
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglertpsession.cpp \
#839010:839011 @@ -18,17 +18,24 @@
* once it is configured with local and remote network addresses and a payload type \
is given,
* it let you send and recv a media stream.
*/
- rtpSocket = new QUdpSocket(); //Should it really be created and connected here ???
- connect(rtpSocket, SIGNAL(readyRead()), this, SLOT(rtpDataReady()));
- connect(rtpSocket, SIGNAL(bytesWritten(qint64)), this, \
SLOT(slotBytesWritten(qint64)));
- rtcpSocket = new QUdpSocket();
+
+ rtpSocket = new QUdpSocket(this); //Should it really be created and connected here \
??? + if (d == In)
+ connect(rtpSocket, SIGNAL(readyRead()), this, SLOT(rtpDataReady()));
+ else if (d == Out)
+ connect(rtpSocket, SIGNAL(bytesWritten(qint64)), this, \
SLOT(slotBytesWritten(qint64))); +
+ rtcpSocket = new QUdpSocket(this);
connect(rtcpSocket, SIGNAL(readyRead()), this, SLOT(rtcpDataReady())); // FIXME:Not \
sure I must do this, oRTP will manage that, I don't care about this signal. \
m_rtpSession = rtp_session_new(m_direction == In ? RTP_SESSION_RECVONLY : \
RTP_SESSION_SENDONLY); + rtp_session_set_connected_mode(m_rtpSession, true);
payloadID = -1;
payloadName = "";
receivingTS = 0;
sendingTS = 0;
- rtp_session_set_recv_buf_size(m_rtpSession, 80); // ?????????
+ rtp_session_set_scheduling_mode(m_rtpSession,1);
+ rtp_session_set_blocking_mode(m_rtpSession,1);
+ //rtp_session_set_recv_buf_size(m_rtpSession, 80); // ?????????
}
JingleRtpSession::~JingleRtpSession()
@@ -54,12 +61,14 @@
if (m_direction == In)
{
connect(rtpSocket, SIGNAL(readyRead()), this, SLOT(rtpDataReady()));
+ rtcpSocket->bind(rtcpPort == 0 ? rtpSocket->localPort() + 1 : rtcpPort);
+ kDebug() << "RTCP socket bound to" << rtcpSocket->localPort();
//bind --> socket already bound.
}
else if (m_direction == Out)
{
connect(rtpSocket, SIGNAL(bytesWritten(qint64)), this, \
SLOT(slotBytesWritten(qint64)));
- rtcpSocket->connectToHost(rtpSocket->peerAddress(), rtcpPort == 0 ? \
rtpSocket->localPort() + 1 : rtcpPort, QIODevice::ReadWrite); \
+ rtcpSocket->connectToHost(rtpSocket->peerAddress(), rtcpPort == 0 ? \
rtpSocket->peerPort() + 1 : rtcpPort, QIODevice::ReadWrite); }
rtp_session_set_sockets(m_rtpSession, rtpSocket->socketDescriptor(), \
rtcpSocket->socketDescriptor()); }
@@ -87,23 +96,26 @@
void JingleRtpSession::rtpDataReady()
{
qDebug() << "JingleRtpSession::rtpDataReady";
- //if (payloadID == -1)
- // return;
- //int haveMore;
- //uint8_t *buf = new uint8_t[50];
- //int size = rtp_session_recv_with_ts(m_rtpSession, buf, 50, receivingTS, \
&haveMore); +
+ kDebug() << "receivingTS =" << receivingTS;
- //kDebug() << "Received" << size << "bytes : " << (char*) buf << "and" << haveMore \
<< "more left";
-
- //mblk_t *packet = rtp_session_recvm_with_ts(m_rtpSession, receivingTS);
+ mblk_t *packet;
+ while ((packet = rtp_session_recvm_with_ts(m_rtpSession, receivingTS)) == NULL)
+ {
+ kDebug() << "Packet is Null, retrying.";
+ receivingTS += payloadTS; //FIXME:What is the increment ? It depends on the \
payload. + }
//data is : packet->b_cont->b_rptr
//of length : len=packet->b_cont->b_wptr - packet->b_cont->b_rptr;
- //data.data() = (char*) packet->b_cont->b_rptr;
- //kDebug(KDE_DEFAULT_DEBUG_AREA) << "Received" << packet->b_cont->b_wptr - \
packet->b_cont->b_rptr << "bytes"; // CRASH HERE
- //QByteArray data((char*) packet->b_cont->b_rptr, packet->b_cont->b_wptr - \
packet->b_cont->b_rptr);
- //char* = unsigned char*
- //kDebug(KDE_DEFAULT_DEBUG_AREA) << "Received (" << packet->b_cont->b_wptr - \
packet->b_cont->b_rptr << "bytes) : " << data;
- receivingTS += payloadTS; //FIXME:What is the increment ? It depends on the \
payload. + QByteArray data((char*) packet->b_cont->b_rptr, packet->b_cont->b_wptr - \
packet->b_cont->b_rptr); + kDebug(KDE_DEFAULT_DEBUG_AREA) << "Received (" << \
packet->b_cont->b_wptr - packet->b_cont->b_rptr << "bytes) : " << data; +
+ // Seems we should empty the socket...
+ QByteArray buf;
+ buf.resize(rtpSocket->pendingDatagramSize());
+ rtpSocket->readDatagram(buf.data(), rtpSocket->pendingDatagramSize());
+
+ emit readyRead(data);
}
void JingleRtpSession::rtcpDataReady()
@@ -120,6 +132,8 @@
payloadTS = 2000; // For testing, data sent each 2000 ms TODO:Change that !!!
RtpProfile *profile = rtp_profile_new(payloadName.toAscii());
rtp_profile_set_payload(profile, 96, &payload_type_theora);
+ rtp_session_set_profile(m_rtpSession, profile);
+ rtp_session_set_payload_type(m_rtpSession, 96);
}
void JingleRtpSession::slotBytesWritten(qint64 size)
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglertpsession.h \
#839010:839011 @@ -53,6 +53,7 @@
signals:
void dataSent();
+ void readyRead(const QByteArray&);
private:
QUdpSocket *rtpSocket;
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/libiris/iris/jabber/jinglesession.cpp \
#839010:839011 @@ -397,15 +397,15 @@
c->startSending();
//Sending my own candidate:
- JT_JingleAction *cAction = new JT_JingleAction(d->rootTask);
- cAction->setSession(this);
- cAction->transportInfo(c);
+ //JT_JingleAction *cAction = new JT_JingleAction(d->rootTask);
+ //cAction->setSession(this);
+ //cAction->transportInfo(c);
//TODO:after sending this, this content must be ready to receive data.
//Sending "trying" stanzas
- JT_JingleAction *tAction = new JT_JingleAction(d->rootTask);
- tAction->setSession(this);
- tAction->trying(*c);
+ //JT_JingleAction *tAction = new JT_JingleAction(d->rootTask);
+ //tAction->setSession(this);
+ //tAction->trying(*c);
}
void JingleSession::slotSessTerminated()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic