Bugreport: switched members in RTCPSenderInfo

Mattias Seeman <[email protected]> Tue, 13 Nov 2007 01:11:28 +0100
Newsgroups gmane.comp.gnu.ccrtp.devel
Organization Rotundus
Message-ID <[email protected]>
Hi all,

I found a bug in ccrtp-1.5.2 in the class RTCPSenderInfo:
 
The fields packetCount and octetCount are switched in the access methods. I
haven't actually used them for anything but a packetCount much higher than
the octetCount must clearly be wrong.

--- ccrtp-1.5.2/src/ccrtp/rtcppkt.h	2007-09-26 15:54:30.000000000 +0200
+++ ccrtp-1.5.2-patched/src/ccrtp/rtcppkt.h	2007-11-13 00:59:45.000000000
+0100
@@ -483,11 +488,11 @@
 	 **/
 	inline uint32
 	getPacketCount() const
-	{ return ntohl(senderInfo.octetCount); }
+	{ return ntohl(senderInfo.packetCount); }
 	
 	inline uint32
 	getOctetCount() const
-	{ return ntohl(senderInfo.packetCount); }
+	{ return ntohl(senderInfo.octetCount); }
 
 private:
 	RTCPCompoundHandler::SenderInfo senderInfo;


Also, without going into detail, the constructor RTCPSenderInfo(void* si)
messes up the SenderInfo struct for me. Using the following patch solves
the problem for me.

--- ccrtp-1.5.2/src/ccrtp/rtcppkt.h	2007-09-26 15:54:30.000000000 +0200
+++ ccrtp-1.5.2-patched/src/ccrtp/rtcppkt.h	2007-11-13 00:59:45.000000000
+0100
@@ -454,7 +454,12 @@
 	RTCPSenderInfo(void* si)
 	{ memcpy(&senderInfo,&si,
 		 sizeof(RTCPCompoundHandler::SenderInfo));}
-
+                 
+        RTCPSenderInfo(RTCPCompoundHandler::SenderInfo& si)
+        : senderInfo( si )
+        {
+        }
+        
 	~RTCPSenderInfo()
 	{ }
 


kr,
\Mattias Seeman