[rtmpdump] r136 - trunk/rtmp.c

hyc subversion at mplayerhq.hu
Wed Dec 30 00:16:11 CET 2009


Author: hyc
Date: Wed Dec 30 00:16:09 2009
New Revision: 136

Log:
More fixes for SendPacket channels

Modified:
   trunk/rtmp.c

Modified: trunk/rtmp.c
==============================================================================
--- trunk/rtmp.c	Tue Dec 29 23:56:25 2009	(r135)
+++ trunk/rtmp.c	Wed Dec 30 00:16:09 2009	(r136)
@@ -2170,7 +2170,7 @@ RTMP_SendPacket(RTMP * r, RTMPPacket * p
 
   int nSize = packetSize[packet->m_headerType];
   int hSize = nSize, cSize = 0;
-  char *header, *hptr, *hend, hbuf[RTMP_MAX_HEADER_SIZE];
+  char *header, *hptr, *hend, hbuf[RTMP_MAX_HEADER_SIZE], c;
 
   if (packet->m_body)
     {
@@ -2194,7 +2194,19 @@ RTMP_SendPacket(RTMP * r, RTMPPacket * p
     }
 
   hptr = header;
-  *hptr++ = (char) ((packet->m_headerType << 6) | (packet->m_nChannel & 0x3f));
+  c = packet->m_headerType << 6;
+  switch(cSize)
+    {
+    case 0:
+      c |= packet->m_nChannel;
+      break;
+    case 1:
+      break;
+    case 2:
+      c |= 1;
+      break;
+    }
+  *hptr++ = c;
   if (cSize)
     {
       int tmp = packet->m_nChannel - 64;
@@ -2254,7 +2266,7 @@ RTMP_SendPacket(RTMP * r, RTMPPacket * p
               header -= cSize;
               hSize += cSize;
             }
-	  *header = (0xc0 | (packet->m_nChannel & 0x3f));
+	  *header = (0xc0 | c);
           if (cSize)
             {
               int tmp = packet->m_nChannel - 64;


More information about the rtmpdump mailing list