]> granicus.if.org Git - rtmpdump/commitdiff
More fixes for pause/resume - don't overwrite pauseStamp if already paused
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 14 Feb 2010 20:46:47 +0000 (20:46 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Sun, 14 Feb 2010 20:46:47 +0000 (20:46 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@250 400ebc74-4327-4243-bc38-086b20814532

rtmp.c

diff --git a/rtmp.c b/rtmp.c
index 490e3201c1d5cf97c747497d51f625b77c7682b6..2de8d288acdcefd9f82526922dfc20cb8bdf124d 100644 (file)
--- a/rtmp.c
+++ b/rtmp.c
@@ -524,12 +524,14 @@ RTMP_ToggleStream(RTMP * r)
 {
   bool res;
 
-  res = RTMP_SendPause(r, true, r->m_pauseStamp);
-  if (!res)
-    return res;
-
-  r->m_pausing = 1;
-  sleep(1);
+  if (!r->m_pausing) {
+    res = RTMP_SendPause(r, true, r->m_pauseStamp);
+    if (!res)
+      return res;
+
+    r->m_pausing = 1;
+    sleep(1);
+  }
   res = RTMP_SendPause(r, false, r->m_pauseStamp);
   r->m_pausing = 3;
   return res;
@@ -584,7 +586,7 @@ RTMP_GetNextMediaPacket(RTMP * r, RTMPPacket * packet)
 
   if (bHasMediaPacket)
     r->m_bPlaying = true;
-  else if (r->m_bTimedout)
+  else if (r->m_bTimedout && !r->m_pausing)
     r->m_pauseStamp = r->m_channelTimestamp[r->m_mediaChannel];
 
   return bHasMediaPacket;
@@ -1129,6 +1131,8 @@ RTMP_SendPause(RTMP * r, bool DoPause, double dTime)
 
   packet.m_nBodySize = enc - packet.m_body;
 
+  Log(LOGDEBUG, "%s, %d, pauseTime=%.2f",
+      __FUNCTION__, DoPause, dTime);
   return RTMP_SendPacket(r, &packet, true);
 }