[rtmpdump] r379 - in trunk/librtmp: rtmp.c rtmp.h
hyc
subversion at mplayerhq.hu
Mon Mar 22 00:34:33 CET 2010
Author: hyc
Date: Mon Mar 22 00:34:32 2010
New Revision: 379
Log:
Export RTMP_SendClientBW()
Modified:
trunk/librtmp/rtmp.c
trunk/librtmp/rtmp.h
Modified: trunk/librtmp/rtmp.c
==============================================================================
--- trunk/librtmp/rtmp.c Sun Mar 21 22:15:06 2010 (r378)
+++ trunk/librtmp/rtmp.c Mon Mar 22 00:34:32 2010 (r379)
@@ -1446,6 +1446,27 @@ RTMP_SendServerBW(RTMP *r)
return RTMP_SendPacket(r, &packet, false);
}
+bool
+RTMP_SendClientBW(RTMP *r)
+{
+ RTMPPacket packet;
+ char pbuf[256], *pend = pbuf + sizeof(pbuf);
+
+ packet.m_nChannel = 0x02; // control channel (invoke)
+ packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
+ packet.m_packetType = 0x06; // Client BW
+ packet.m_nInfoField1 = 0;
+ packet.m_nInfoField2 = 0;
+ packet.m_hasAbsTimestamp = 0;
+ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
+
+ packet.m_nBodySize = 5;
+
+ AMF_EncodeInt32(packet.m_body, pend, r->m_nClientBW);
+ packet.m_body[4] = r->m_nClientBW2;
+ return RTMP_SendPacket(r, &packet, false);
+}
+
static bool
SendBytesReceived(RTMP *r)
{
@@ -1636,6 +1657,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
RTMPPacket packet;
char pbuf[256], *pend = pbuf + sizeof(pbuf);
+ int nSize;
packet.m_nChannel = 0x02; // control channel (ping)
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
@@ -1645,9 +1667,12 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
packet.m_hasAbsTimestamp = 0;
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
- int nSize = (nType == 0x03 ? 10 : 6); // type 3 is the buffer time and requires all 3 parameters. all in all 10 bytes.
- if (nType == 0x1B)
- nSize = 44;
+ switch(nType) {
+ case 0x03: nSize = 10; break; /* buffer time */
+ case 0x1A: nSize = 3; break; /* SWF verify request */
+ case 0x1B: nSize = 44; break; /* SWF verify response */
+ default: nSize = 6; break;
+ }
packet.m_nBodySize = nSize;
@@ -1662,6 +1687,10 @@ RTMP_SendCtrl(RTMP *r, short nType, unsi
RTMP_LogHex(RTMP_LOGDEBUG, packet.m_body, packet.m_nBodySize);
#endif
}
+ else if (nType == 0x1A)
+ {
+ *buf = nObject & 0xff;
+ }
else
{
if (nSize > 2)
Modified: trunk/librtmp/rtmp.h
==============================================================================
--- trunk/librtmp/rtmp.h Sun Mar 21 22:15:06 2010 (r378)
+++ trunk/librtmp/rtmp.h Mon Mar 22 00:34:32 2010 (r379)
@@ -293,6 +293,7 @@ extern "C"
bool RTMP_SendCreateStream(RTMP *r);
bool RTMP_SendSeek(RTMP *r, double dTime);
bool RTMP_SendServerBW(RTMP *r);
+ bool RTMP_SendClientBW(RTMP *r);
void RTMP_DropRequest(RTMP *r, int i, bool freeit);
int RTMP_Read(RTMP *r, char *buf, int size);
int RTMP_Write(RTMP *r, char *buf, int size);
More information about the rtmpdump
mailing list