[rtmpdump] r39 - rtmp.cpp rtmp.h

hyc subversion at mplayerhq.hu
Tue Nov 10 11:10:41 CET 2009


Author: hyc
Date: Tue Nov 10 11:10:41 2009
New Revision: 39

Log:
Discard old frames when doing pause/resume

Modified:
   rtmp.cpp
   rtmp.h

Modified: rtmp.cpp
==============================================================================
--- rtmp.cpp	Tue Nov 10 03:37:24 2009	(r38)
+++ rtmp.cpp	Tue Nov 10 11:10:41 2009	(r39)
@@ -420,6 +420,13 @@ int CRTMP::GetNextMediaPacket(RTMPPacket
     if (!bHasMediaPacket) { 
       packet.FreePacket();
     }
+    if (m_bPausing == 3) {
+      if (packet.m_nTimeStamp <= m_pauseStamp) {
+	bHasMediaPacket = false;
+	continue;
+      }
+      m_bPausing = 0;
+    }
   }
         
   if (bHasMediaPacket)
@@ -1309,7 +1316,6 @@ void CRTMP::HandleCtrl(const RTMPPacket 
     case 0:
       tmp = ReadInt32(packet.m_body + 2);
       Log(LOGDEBUG, "%s, Stream Begin %d", __FUNCTION__, tmp);
-      m_bPausing = 0;
       break;
 
     case 1:
@@ -1339,10 +1345,11 @@ void CRTMP::HandleCtrl(const RTMPPacket 
       tmp = ReadInt32(packet.m_body + 2);
       Log(LOGDEBUG, "%s, Stream BufferEmpty %d", __FUNCTION__, tmp);
       if (!m_bPausing) {
-        SendPause(true, m_channelTimestamp[m_mediaChannel]);
+	m_pauseStamp = m_channelTimestamp[m_mediaChannel];
+        SendPause(true, m_pauseStamp);
         m_bPausing = 1;
       } else if (m_bPausing == 2) {
-        SendPause(false, m_channelTimestamp[m_mediaChannel]);
+        SendPause(false, m_pauseStamp);
         m_bPausing = 3;
       }
       break;

Modified: rtmp.h
==============================================================================
--- rtmp.h	Tue Nov 10 03:37:24 2009	(r38)
+++ rtmp.h	Tue Nov 10 11:10:41 2009	(r39)
@@ -217,6 +217,7 @@ class CRTMP
       int  m_nBufferMS;
       int  m_stream_id; // returned in _result from invoking createStream
       int  m_mediaChannel;
+      uint32_t  m_pauseStamp;
       bool m_bTimedout;
       int m_bPausing;
       int m_nClientBW;


More information about the rtmpdump mailing list