From 8fc01735f1a579a4f5add95dc76afdb2024aff45 Mon Sep 17 00:00:00 2001 From: hyc Date: Tue, 29 Dec 2009 23:16:09 +0000 Subject: [PATCH] More fixes for SendPacket channels git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@136 400ebc74-4327-4243-bc38-086b20814532 --- rtmp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/rtmp.c b/rtmp.c index 07ea2cf..c7ca819 100644 --- a/rtmp.c +++ b/rtmp.c @@ -2170,7 +2170,7 @@ RTMP_SendPacket(RTMP * r, RTMPPacket * packet, bool queue) 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 * packet, bool queue) } 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 * packet, bool queue) header -= cSize; hSize += cSize; } - *header = (0xc0 | (packet->m_nChannel & 0x3f)); + *header = (0xc0 | c); if (cSize) { int tmp = packet->m_nChannel - 64; -- 2.40.0