[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-08-14 22:11:07
Message-ID: 1218751867.094730.4826.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 847187 by casanova:

 * NULL JingleMediaSession bug fixed.


 M  +4 -2      jingle/jabberjinglecontent.cpp  
 M  +19 -8     libiris/iris/jabber/jinglecontent.cpp  
 M  +2 -1      libiris/iris/jabber/jinglecontent.h  
 M  +0 -1      libiris/iris/jabber/jinglesession.cpp  
 M  +28 -6     libiris/iris/jabber/jinglesessionmanager.cpp  
 M  +6 -0      libiris/iris/jabber/jinglesessionmanager.h  


--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jabberjinglecontent.cpp \
#847186:847187 @@ -95,7 +95,7 @@
 
 void JabberJingleContent::startWritingRtpData()
 {
-	qDebug() << "Start Writing Rtp Data.";
+	kDebug() << "Start Writing Rtp Data.";
 	
 	//slotPrepareRtpOutSession(); --> That should already be done...
 
@@ -108,7 +108,9 @@
 		m_mediaSession = m_mediaManager->createNewSession(m_content->bestPayload());
 		if (m_mediaSession == 0)
 		{
-			qDebug() << "Media Session is NULL!";
+			kDebug() << "Media Session is NULL!";
+			kDebug() << "Number of payloads :" << m_content->payloadTypes().count();
+			kDebug() << "Number of responder payloads :" << \
m_content->responderPayloads().count();  return;
 		}
 		connect(m_mediaSession, SIGNAL(readyRead(int)), this, SLOT(slotReadyRead(int)));
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/libiris/iris/jabber/jinglecontent.cpp \
#847186:847187 @@ -72,8 +72,13 @@
 	delete d;
 }
 
-QDomElement JingleContent::bestPayload() const
+QDomElement JingleContent::bestPayload()
 {
+	if (d->bestPayload.isNull())
+	{
+		//Trying to update the best payload.
+		d->bestPayload = bestPayload(d->rPayloads, d->payloads);
+	}
 	return d->bestPayload;
 }
 
@@ -139,13 +144,16 @@
 	d->descriptionNS = desc.attribute("xmlns");
 	d->type = stringToType(desc.attribute("media"));
 	QDomElement payload = desc.firstChildElement();
+	// This content is created from XML data, that means that it comes from the \
outside. +	// So, pyloads are added as responder payloads
+	QList<QDomElement> payloads;
 	while (!payload.isNull())
 	{
-		// This content is created from XML data, that means that it comes from the \
                outside.
-		// So, pyloads are added as responder payloads
-		d->rPayloads << payload;
+		payloads << payload;
 		payload = payload.nextSiblingElement();
 	}
+	setResponderPayloads(payloads);
+
 	QDomElement transport = desc.nextSiblingElement();
 	d->transport = transport;
 }
@@ -375,11 +383,9 @@
 	
 	connect(d->inSocket, SIGNAL(readyRead()), this, SLOT(slotRawUdpDataReady()));
 	
-	emit inSocketReady();
+	//emit inSocketReady();
 }
 
-
-
 JingleContent& JingleContent::operator=(const JingleContent &other)
 {
 	d->payloads = other.payloadTypes();
@@ -421,7 +427,7 @@
 {
 	qDebug() << "*******Setting responder payloads**********";
 	d->rPayloads = payloads;
-	if (d->payloads.count() != 0)
+	if (d->payloads.count() != 0) //No, if payloads is empty, we should get the list \
from the supported payloads. Actually, those payloads should be always set when \
creating the content.  {
 		//Store the best payload to use for this content.
 		//The application will just have to get it from this content.
@@ -429,6 +435,11 @@
 	}
 }
 
+QList<QDomElement> JingleContent::responderPayloads() const
+{
+	return d->rPayloads;
+}
+
 JingleContent::Type JingleContent::stringToType(const QString& s)
 {
 	if (s == "video")
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/libiris/iris/jabber/jinglecontent.h \
#847186:847187 @@ -88,8 +88,9 @@
 		Type stringToType(const QString& s);
 
 		void setResponderPayloads(const QList<QDomElement>&);
+		QList<QDomElement> responderPayloads() const;
 
-		QDomElement bestPayload() const;
+		QDomElement bestPayload();
 
 	public slots:
 		void slotRawUdpDataReady();
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/libiris/iris/jabber/jinglesession.cpp \
#847186:847187 @@ -199,7 +199,6 @@
 	acceptSession();
 
 	disconnect(sender(), 0, this, 0);
-
 }
 
 void JingleSession::sessionAccepted(const QDomElement& x)
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/libiris/iris/jabber/jinglesessionmanager.cpp \
#847186:847187 @@ -119,21 +119,43 @@
 void JingleSessionManager::slotSessionIncoming()
 {
 	qDebug() << "JingleSessionManager::slotSessionIncoming() called.";
-	d->sessions << d->pjs->takeNextIncomingSession();
+	JingleSession *sess = d->pjs->takeNextIncomingSession();
+	d->sessions << sess;
 
-	// TODO:Check if at least one payload is supported.
 	// 	Check if the Transport method is supported.
+	for (int i = 0; i < sess->contents().count(); i++)
+	{
+		JingleContent *c = sess->contents()[i];
 
-	// FIXME:
-	// 	QList<T>.last() should be called only if the list is not empty.
-	// 	Could it happen here as we just append an element to the list ?
-	emit newJingleSession(d->sessions.last());
+		// Check payloads for the content c
+		if (!checkSupportedPayloads(c))
+		{
+			//Do what ever is necessary.
+			//I think we have to send a no payload supported stanza.
+			return;
+		}
+
+		//Check transport
+		//TODO
+
+		//Set supported payloads for this content.
+		
+		c->setPayloadTypes(c->type() == JingleContent::Audio ? d->supportedAudioPayloads : \
d->supportedVideoPayloads); +	}
+	emit newJingleSession(sess);
 	qDebug() << "SEND RINGING.";
 	d->sessions.last()->ring();
 	qDebug() << "START NEGOTIATION";
 	d->sessions.last()->startNegotiation();
 }
 
+bool JingleSessionManager::checkSupportedPayloads(JingleContent *c)
+{
+	Q_UNUSED(c)
+	//TODO:Implement me !
+	return true;
+}
+
 //void JingleSessionManager::removeContent(const QString& sid, const QString& cName)
 //{
 //	for (int i = 0; i < )
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/libiris/iris/jabber/jinglesessionmanager.h \
#847186:847187 @@ -105,6 +105,12 @@
 		 * Returns the session with the SID sid.
 		 */
 		JingleSession *session(const QString& sid);
+
+		/*
+		 * Check if this content has supported contents.
+		 * If yes, returns true, returns false if not.
+		 */
+		bool checkSupportedPayloads(JingleContent *c);
 	};
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic