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

List:       helix-protocol-cvs
Subject:    [Protocol-cvs] transport/rtp Umakefil, 1.6, 1.7 rtcputil.cpp, 1.13,
From:       acolwell () helixcommunity ! org
Date:       2004-11-19 18:23:30
[Download RAW message or body]

Update of /cvsroot/protocol/transport/rtp
In directory cvs-new:/tmp/cvs-serv4938

Modified Files:
	Umakefil rtcputil.cpp rtptran.cpp 
Log Message:
OBSN -> NADU conversion


Index: rtcputil.cpp
===================================================================
RCS file: /cvsroot/protocol/transport/rtp/rtcputil.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- rtcputil.cpp	9 Jul 2004 18:41:04 -0000	1.13
+++ rtcputil.cpp	19 Nov 2004 18:23:28 -0000	1.14
@@ -60,6 +60,8 @@
 #include "ntptime.h"
 #include "rtcputil.h"
 
+#include "hxtlogutil.h"
+
 #include "hxheap.h"
 #ifdef _DEBUG
 #undef HX_THIS_FILE		
@@ -529,9 +531,12 @@
 }
 
 HX_RESULT 
-ReportHandler::MakeOBSN(RTCPPacket* pPkt, 
-                        UINT16 uSequenceNum,
-                        UINT16 uPlayoutDelay)
+ReportHandler::MakeNADU(RTCPPacket* pPkt,
+                        BOOL bNextSeqValid,
+                        UINT16 uPlayoutDelay,
+                        UINT16 uNextSeqNumber,
+                        UINT16 uNextUnitNumber,
+                        UINT16 uFreeBufferSpace)
 {
     HX_RESULT res = HXR_UNEXPECTED;
 
@@ -542,6 +547,32 @@
         CHXMapLongToObj::Iterator i = m_mapSenders.Begin();
         UINT32 ulSSRC = (UINT32)i.get_key();
 
+        if (!bNextSeqValid)
+        {
+            ReceptionInfo* pRInfo = (ReceptionInfo*)(*i);
+            
+            // We don't have any valid sequence number info so
+            // we are going to report the next expected sequence
+            // number.
+            uNextSeqNumber = (pRInfo->m_ulCycles + 
+                              pRInfo->m_unMaxSeqNo + 1) & 0xffff;
+
+            // We don't know the playout delay so just set it to
+            // the reserved value
+            uPlayoutDelay = 0xffff;
+
+            // We don't have a unit number so just set it to 0
+            uNextUnitNumber = 0;
+
+            // uFreeBufferSpace is expected to have a valid value in
+            // this situation
+        }
+        
+        HXLOGL3(HXLOG_TRAN, "NADU %08x %5u %5u %5u %5u (%5u)\n", 
+                ulSSRC, uPlayoutDelay, uNextSeqNumber, uNextUnitNumber,
+                uFreeBufferSpace,
+                uFreeBufferSpace * 64);
+
 	pPkt->version_flag = 0x02;
 	pPkt->padding_flag = 0;    
 	pPkt->packet_type = RTCP_APP;
@@ -550,16 +581,16 @@
 	memcpy(pPkt->app_name, "PSS0", 4);
         pPkt->length = 2;
 
-        UINT8 obsnBuf[8];
-        UINT32* pSSRC = (UINT32*)&obsnBuf[0];
-        UINT16* pDelay = (UINT16*)&obsnBuf[4];
-        UINT16* pSeq = (UINT16*)&obsnBuf[6];
+        UINT16 naduBuf[6];
 
+        UINT32* pSSRC = (UINT32*)&naduBuf[0];
         *pSSRC = DwToNet(ulSSRC);
-        *pDelay = WToNet(uPlayoutDelay);
-        *pSeq = WToNet(uSequenceNum);
+        naduBuf[2] = WToNet(uPlayoutDelay);
+        naduBuf[3] = WToNet(uNextSeqNumber);
+        naduBuf[4] = WToNet(uNextUnitNumber & 0x1f);
+        naduBuf[5] = WToNet(uFreeBufferSpace);
 
-        pPkt->SetAPPData(obsnBuf, sizeof(obsnBuf));
+        pPkt->SetAPPData((const UINT8*)naduBuf, sizeof(naduBuf));
 	res = HXR_OK;
     }
 

Index: rtptran.cpp
===================================================================
RCS file: /cvsroot/protocol/transport/rtp/rtptran.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- rtptran.cpp	9 Nov 2004 23:29:06 -0000	1.79
+++ rtptran.cpp	19 Nov 2004 18:23:28 -0000	1.80
@@ -2449,8 +2449,8 @@
     m_ulLastLoss (0),
     m_ulLastRate (0),
     m_pTSScheduler (NULL),
-    m_pOBSN(NULL),
-    m_ulOBSNRRCount(0)
+    m_pNADU(NULL),
+    m_ulNADURRCount(0)
 {
 }
 
@@ -2511,7 +2511,7 @@
     HX_RELEASE(m_pSignalBus);
     HX_RELEASE(m_pSessionId);
 
-    HX_RELEASE(m_pOBSN);
+    HX_RELEASE(m_pNADU);
 }
 
 HX_RESULT
@@ -2532,12 +2532,12 @@
     m_pcCNAME = (BYTE*)new_string(cname);
     HX_ASSERT(m_pcCNAME);
 
-    HX_RELEASE(m_pOBSN);
+    HX_RELEASE(m_pNADU);
     if (m_pContext)
     {
-        m_pContext->QueryInterface(IID_IHX3gppOBSN,
-                                   (void**)&m_pOBSN);
-        m_ulOBSNRRCount = 0;
+        m_pContext->QueryInterface(IID_IHX3gppNADU,
+                                   (void**)&m_pNADU);
+        m_ulNADURRCount = 0;
     }
 
     return HXR_OK;
@@ -3360,7 +3360,7 @@
 //    IHXBuffer* pSendBuf = NULL;
     RTCPPacket* pPktSDES = NULL;
     RTCPPacket* pPktBufInfo = NULL;
-    RTCPPacket* pPktOBSN = NULL;
+    RTCPPacket* pPktNADU = NULL;
 
     HXTimeval rmatv = m_pScheduler->GetCurrentSchedulerTime();
     UINT32 ulNow = rmatv.tv_sec*1000 + rmatv.tv_usec/1000;
@@ -3399,44 +3399,55 @@
         goto bail;
     }
 
-    if (m_pOBSN && m_pReportHandler)
+    if (m_pNADU && m_pReportHandler)
     {
         UINT32 uFreq = 0;
 
         // increment RR counter
-        m_ulOBSNRRCount++;
+        m_ulNADURRCount++;
 
-        // Get OBSN report frequency
-        m_pOBSN->GetOBSNFrequency(m_streamNumber, uFreq);
+        // Get NADU report frequency
+        m_pNADU->GetNADUFrequency(m_streamNumber, uFreq);
 
         if (uFreq)
         {
-            // We are sending OBSN packets so
+            // We are sending NADU packets so
             // we don't beed to generate BufInfo APP
             // packets.
             bNeedBufInfoPkt = FALSE;
 
-            if (m_ulOBSNRRCount >= uFreq)
+            if (m_ulNADURRCount >= uFreq)
             {
-                // Time to send an OBSN packet
+                // Time to send an NADU packet
                 
-                UINT16 uSequenceNum = 0;
-                UINT16 uPlayoutDelay = 0;
+                UINT16 uPlayoutDelay;
+                UINT16 uNextSeqNumber;
+                UINT16 uNextUnitNumber;
+                UINT16 uFreeBufferSpace;
                 
-                pPktOBSN = new RTCPPacket();
+                pPktNADU = new RTCPPacket();
                 
-                if ((HXR_OK ==  m_pOBSN->GetOBSNInfo(m_streamNumber,
-                                                     uSequenceNum,
-                                                     uPlayoutDelay)) &&
-                    (HXR_OK == m_pReportHandler->MakeOBSN(pPktOBSN,
-                                                          uSequenceNum,
-                                                          uPlayoutDelay)))
+                HX_RESULT tmpRes = m_pNADU->GetNADUInfo(m_streamNumber,
+                                                        uPlayoutDelay,
+                                                        uNextSeqNumber,
+                                                        uNextUnitNumber,
+                                                        uFreeBufferSpace);
+
+                BOOL bNextSeqValid = (HXR_OK == tmpRes) ? TRUE : FALSE;
+
+                if ((bNextSeqValid || (HXR_NO_DATA == tmpRes)) &&
+                    (HXR_OK == m_pReportHandler->MakeNADU(pPktNADU,
+                                                          bNextSeqValid,
+                                                          uPlayoutDelay,
+                                                          uNextSeqNumber,
+                                                          uNextUnitNumber,
+                                                          uFreeBufferSpace)))
                 {
-                    // We successfully created an OBSN
+                    // We successfully created an NADU
                     // packet.
                     
                     // Reset our RR counter to 0
-                    m_ulOBSNRRCount = 0;
+                    m_ulNADURRCount = 0;
                 }
                 else
                 {
@@ -3444,9 +3455,9 @@
                     // just delete the packet so that
                     // it doesn't get included in the
                     // compound packet. Failing to
-                    // send an OBSN is not a
+                    // send an NADU is not a
                     // critical error
-                    HX_DELETE(pPktOBSN);
+                    HX_DELETE(pPktNADU);
                 }
             }
         }
@@ -3496,9 +3507,9 @@
         packer.Set(pPktBufInfo);
     }
 
-    if (pPktOBSN)
+    if (pPktNADU)
     {
-        packer.Set(pPktOBSN);
+        packer.Set(pPktNADU);
     }
 
     theErr = packer.Pack(pSendBuf);
@@ -3517,7 +3528,7 @@
     HX_DELETE(pPktRR);
     HX_DELETE(pPktSDES);
     HX_DELETE(pPktBufInfo);
-    HX_DELETE(pPktOBSN);
+    HX_DELETE(pPktNADU);
 //    HX_RELEASE(pSendBuf);
     return theErr;
 }

Index: Umakefil
===================================================================
RCS file: /cvsroot/protocol/transport/rtp/Umakefil,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Umakefil	23 Jul 2004 23:39:15 -0000	1.6
+++ Umakefil	19 Nov 2004 18:23:28 -0000	1.7
@@ -59,6 +59,7 @@
                           "common/system/pub", 
                           "common/fileio/pub", 
 			  "common/runtime/pub",
+			  "common/log/logutil/pub",
 			  "client/common/container/pub",
 			  "datatype/rm/include")
 



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

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