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

List:       helix-server-cvs
Subject:    [Server-cvs]
From:       jgordon () helixcommunity ! org
Date:       2010-05-20 23:30:39
Message-ID: 201005202330.o4KNUUKq006695 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/common/util/pub
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv30433/pub

Modified Files:
      Tag: SERVER_14_0
	livepacketq.h pktqmgr.h pktreorderqueue.h 
Log Message:
Synopsis
========
Fixes the encoder disconnect and poor behavior in case of large blocks
of packet loss and some other RTP live bugs, some of which were
partially worked around.

Branches: SERVER_14_0, HEAD (SERVER_CURRENT)
Reviewer: chytanya


Description
===========
When sending a lost packet, the reordering queue was not re-checking
the gap size to send additional lost packets right away, instead going
back into buffering mode and waiting for a packet to be received before
sending the next lost packet. This would cause inappropriate buffering
etc. after a block of loss. A slightly incorrect change to the sending
logic compounded this to send lost packet only when receiving a packet
for the 'next' stream (rather than either) so in case of large blocks
of loss across streams, the one stream (the one with the later packet
time) would eventually over-buffer beyond the limit while it very
slowly doled out the lost packets for the other stream. The same change
also screwed up the buffer flushing behavior where it would keep
trying  to find packets when it should have stopped.

This change updates SendNext to ensure to always send at least one
packet (lost packet if no packet available) and re-check the loss
threshhold after sending (instead of just on receiving!) in order
to set state and handle appropriately. Also changes lost packet objects
to use the time stamps of the last good packet on the stream rather
than the next, as all lost packets should be treated as past/late, not
future, etc.

Pulls apart the Flush sending from the normal sending and corrects it
back to send all packets until there is nothing left and then stop the
feed. This was moved out because the handling is quite different and
it is preferable to have a small block of identical code for both than
to have the normal packet path laden with a bunch of branches and junk
for the flush case.

And finally, a pop from the stream queue was incrementing the
m_FirstSequenceNumber even if the queue was empty. Then the next
time we try to use the queue it gets off and it winds up thinking
it has (UINT16)-1 sequence gap to fill. Normally a pop on empty
queue should only ever happen one time at the end of flushing and the
queue would never really be accessed again anyway, but due to above
issue with flushing, this was getting accessed multiple times. This is
presumably the root cause of the issue we added the limit on that queue
size for, where it was going suddenly crazy huge on end of feed.


Files Affected
==============
server/common/util/livepacketq.cpp
server/common/util/pktqmgr.cpp
server/common/util/pub/livepacketq.h
server/common/util/pub/pktqmgr.h
server/common/util/pub/pktreorderqueue.h


Index: livepacketq.h
===================================================================
RCS file: /cvsroot/server/common/util/pub/livepacketq.h,v
retrieving revision 1.4
retrieving revision 1.4.16.1
diff -u -d -r1.4 -r1.4.16.1
--- livepacketq.h	25 Apr 2009 00:04:42 -0000	1.4
+++ livepacketq.h	20 May 2010 23:30:36 -0000	1.4.16.1
@@ -100,6 +100,8 @@
     IHXCommonClassFactory*  m_pClassFactory;
     HXBOOL                  m_bFirstPacket;
     UINT32                  m_ulLastDeliveryTime;
+    UINT32                  m_ulLastRTPTime;
+    UINT32                  m_ulLastMSTS;
     UINT32                  m_ulNextSeq;
 };
 

Index: pktreorderqueue.h
===================================================================
RCS file: /cvsroot/server/common/util/pub/pktreorderqueue.h,v
retrieving revision 1.5
retrieving revision 1.5.16.1
diff -u -d -r1.5 -r1.5.16.1
--- pktreorderqueue.h	7 Apr 2009 19:19:31 -0000	1.5
+++ pktreorderqueue.h	20 May 2010 23:30:37 -0000	1.5.16.1
@@ -207,8 +207,12 @@
 inline CQueueEntry*
 CInorderPacketQueue::pop_front()
 {
-    m_FirstSequenceNumber++;
-    return !m_pPacketDeque->empty() ? (CQueueEntry*)m_pPacketDeque->pop_front() : NULL;
+    if (!m_pPacketDeque->empty())
+    {
+        m_FirstSequenceNumber++;
+        return (CQueueEntry*)m_pPacketDeque->pop_front();
+    }
+    return NULL;
 }
 
 inline CQueueEntry*

Index: pktqmgr.h
===================================================================
RCS file: /cvsroot/server/common/util/pub/pktqmgr.h,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -d -r1.4 -r1.4.4.1
--- pktqmgr.h	8 Oct 2009 20:28:52 -0000	1.4
+++ pktqmgr.h	20 May 2010 23:30:36 -0000	1.4.4.1
@@ -89,6 +89,7 @@
 private:
     inline void ClearCallback();
     HXBOOL SendNext();
+    HXBOOL FlushPackets();
     IHXServerPacketExt* GetNextPacket();
     void HandleBuffer();
 


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

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