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

List:       kde-commits
Subject:    branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle
From:       Detlev Casanova <detlev.casanova () gmail ! com>
Date:       2008-08-25 16:28:16
Message-ID: 1219681696.833320.10009.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 852247 by casanova:

 * Updated some comments;
 * bufer not written on audio device if size < pSize 


 M  +21 -7     alsaio.cpp  
 M  +1 -0      jabberjinglecontent.cpp  
 M  +1 -1      jinglertpsession.cpp  


--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/alsaio.cpp #852246:852247
@@ -99,9 +99,6 @@
 
 AlsaIO::~AlsaIO()
 {
-	//snd_pcm_drain(handle); --> Crash here...
-	kDebug() << "DESTROYED";
-	snd_pcm_close(handle);
 	if (notifier)
 	{
 		close(notifier->socket());
@@ -110,6 +107,11 @@
 
 	if (timer)
 		delete timer;
+	
+	snd_pcm_drain(handle);
+	snd_pcm_close(handle);
+	
+	kDebug() << "DESTROYED";
 }
 
 AlsaIO::StreamType AlsaIO::type() const
@@ -208,6 +210,7 @@
 
 	kDebug() << "Appending received data (" << data.size() << "bytes)";
 	buf.append(data);
+	kDebug() << "Buffer size is now" << buf.size() << "bytes";
 }
 
 bool AlsaIO::isReady()
@@ -276,11 +279,19 @@
 
 void AlsaIO::writeData()
 {
+	/* We should empty buffer each time this function is called
+	 * (each time Alsa tells us we can write on the device)
+	 * To do so, we need 2 buffers (one for incoming data (A) and one
+	 * for writing on the device (B))
+	 * we begin by writing A on the device, while B is being filled,
+	 * once this method is called, we can empty A and write B on the device, etc...
+	 */
+	
 	//written += buf.size();
 	//kDebug() << "Buffer size =" << buf.size();
-	if (buf.size() <= 0)
+	if (buf.size() < pSize)
 	{
-		kDebug() << "No Data in the buffer.";
+		kDebug() << "No enough Data in the buffer.";
 		return;
 	}
 
@@ -288,8 +299,10 @@
 
 	//written += size;
 
-	if (size < 0) {
-		if (size == -EPIPE) {
+	if (size < 0)
+	{
+		if (size == -EPIPE)
+		{
 			kDebug() << "buffer underrun";
 			prepare();
 			return;
@@ -318,6 +331,7 @@
 {
 	// With a period time of 21333  µs and the A-Law format, we always have 32 bytes.
 	// Here, this is 32 bytes which are all zeros.
+	//buf.fill(static_cast<char>(rand()), 32);
 	buf.fill('\0', 32);
 	emit readyRead();
 }
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jabberjinglecontent.cpp #852246:852247
@@ -48,6 +48,7 @@
 	delete m_content;
 	delete m_rtpInSession;
 	delete m_rtpOutSession;
+	delete m_mediaSession;
 }
 
 void JabberJingleContent::setContent(XMPP::JingleContent* content)
--- branches/work/soc-kopete-jingle/kopete/protocols/jabber/jingle/jinglertpsession.cpp #852246:852247
@@ -187,7 +187,7 @@
 
 void JingleRtpSession::slotBytesWritten(qint64 size)
 {
-	kDebug() << size << "bytes written";
+	//kDebug() << size << "bytes written";
 	//if (state != SendingData)
 	//	return;
 	//emit dataSent();
[prev in list] [next in list] [prev in thread] [next in thread] 

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