[rtmpdump] r45 - rtmp.cpp

hyc subversion at mplayerhq.hu
Wed Nov 11 11:23:50 CET 2009


Author: hyc
Date: Wed Nov 11 11:23:49 2009
New Revision: 45

Log:
Fix _checkbw processing

Modified:
   rtmp.cpp

Modified: rtmp.cpp
==============================================================================
--- rtmp.cpp	Tue Nov 10 22:14:25 2009	(r44)
+++ rtmp.cpp	Wed Nov 11 11:23:49 2009	(r45)
@@ -364,6 +364,7 @@ bool CRTMP::ConnectStream(double seekTim
   if (dLength >= 0)
     Link.length = dLength;
 
+  m_mediaChannel = 0;
   RTMPPacket packet;
   while (!m_bPlaying && IsConnected() && ReadPacket(packet)) {
     if (!packet.IsReady())
@@ -437,6 +438,11 @@ int CRTMP::GetNextMediaPacket(RTMPPacket
         
   if (bHasMediaPacket)
     m_bPlaying = true;
+/*
+  else if (m_bTimedout) {
+    m_pauseStamp = m_channelTimestamp[m_mediaChannel];
+    m_bPausing = 3;
+  } */
 
   return bHasMediaPacket;
 }
@@ -798,7 +804,7 @@ bool CRTMP::SendFCSubscribe(const char *
   Log(LOGDEBUG, "FCSubscribe: %s", subscribepath);
   char *enc = packet.m_body;
   enc += EncodeString(enc, "FCSubscribe");
-  enc += EncodeNumber(enc, 4);
+  enc += EncodeNumber(enc, 4.0);
   *enc = 0x05; // NULL
   enc++;
   enc += EncodeString(enc, subscribepath);
@@ -912,16 +918,17 @@ bool CRTMP::SendCheckBW()
   packet.AllocPacket(256); // should be enough
   char *enc = packet.m_body;
   enc += EncodeString(enc, "_checkbw");
-  enc += EncodeNumber(enc, 5);
+  enc += EncodeNumber(enc, 0);
   *enc = 0x05; // NULL
   enc++;
 
   packet.m_nBodySize = enc - packet.m_body;
 
+  // triggers _onbwcheck and eventually results in _onbwdone 
   return SendRTMP(packet);
 }
 
-bool CRTMP::SendCheckBWResult(int txn)
+bool CRTMP::SendCheckBWResult(double txn)
 {
   RTMPPacket packet;
   bool res;
@@ -1063,7 +1070,7 @@ int CRTMP::HandleInvoke(const char *body
 
   obj.Dump();
   std::string method = obj.GetProperty(0).GetString();
-  int txn = obj.GetProperty(1).GetNumber();
+  double txn = obj.GetProperty(1).GetNumber();
   Log(LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.c_str());
 
 #define CSCMP(a,b)	(a.size() == (sizeof(b)-1)) && !strcmp(a.c_str(),b)
@@ -1125,6 +1132,15 @@ int CRTMP::HandleInvoke(const char *body
   {
     SendCheckBWResult(txn);
   }
+  else if (CSCMP(method,"_onbwdone"))
+  {
+    std::vector<std::string>::iterator i; //remote method calls queue
+    for (i=m_methodCalls.begin(); i<m_methodCalls.end(); i++)
+      if (i[0] == "_checkbw") {
+        m_methodCalls.erase(i);
+        break;
+      }
+  }
   else if (CSCMP(method,"_error"))
   {
     Log(LOGERROR, "rtmp server sent error");


More information about the rtmpdump mailing list