Ported handleclientbw, handleserverbw and handle

changechunksize
This commit is contained in:
saxon 2018-08-12 19:47:53 +09:30
parent dc6e9a9a4b
commit 4f1b6ff56f
1 changed files with 41 additions and 3 deletions

View File

@ -1742,7 +1742,8 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
case RTMP_PACKET_TYPE_CHUNK_SIZE:
log.Println("RTMP_PACKET_TYPE_CHUNK_SIZE")
// TODO: port this
C.HandleChangeChunkSize(r, packet)
//C.HandleChangeChunkSize(r, packet)
C_HandleChangeChunkSize(r, packet)
/*
case RTMP_PACKET_TYPE_BYTES_READ_REPORT:
log.Println("RTMP_PACKET_TYPE_BYTES_READ_REPORT")
@ -1757,12 +1758,14 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
case RTMP_PACKET_TYPE_SERVER_BW:
log.Println("RTMP_PACKET_TYPE_SERVER_BW")
// TODO: port this
C.HandleServerBW(r, packet)
//C.HandleServerBW(r, packet)
C_HandlServerBW(r, packet)
case RTMP_PACKET_TYPE_CLIENT_BW:
log.Println("RTMP_PACKET_TYPE_CLIENT_BW")
// TODO: port this
C.HandleClientBW(r, packet)
//C.HandleClientBW(r, packet)
C_HandlClientBW(r, packet)
/*
case RTMP_PACKET_TYPE_AUDIO:
log.Println("RTMP_PACKET_TYPE_AUDIO")
@ -1863,6 +1866,41 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
return bHasMediaPacket
}
// void HandleChangeChunkSize(RTMP* r, const RTMPPacket* packet);
// rtmp.c +3345
func C_HandleChangeChunkSize(r *C.RTMP, packet *C.RTMPPacket) {
if packet.m_nBodySize >= 4 {
// TODO port C.AMF_DeocdeInt32
r.m_inChunkSize = C.AMF_DecodeInt32(packet.m_body)
// TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG, "%s, received: chunk size change to %d", __FUNCTION__, r->m_inChunkSize);
}
}
// void HandleServerBW(RTMP* r, const RTMPPacket* packet);
// rtmp.c +3508
func C_HandlServerBW(r *C.RTMP, packet *C.RTMPPacket) {
// TODO port AMF_DecodeInt32
r.m_nServerBW = C.AMF_DecodeInt32(packet.m_body)
// TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r->m_nServerBW);
}
// void HandleClientBW(RTMP* r, const RTMPPacket* packet);
// rtmp.c +3515
func C_HandleClientBW(r *C.RTMP, packet *C.RTMPPacket) {
r.m_nClientBW = C.AMF_DeocdeInt32(packet.m_body)
if packet.m_nBodySize > 4 {
r.m_nClientBW2 = packet.m_body[4]
} else {
r.m_nClientBW2 = -1
}
// TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG, "%s: client BW = %d %d", __FUNCTION__, r->m_nClientBW,
//r->m_nClientBW2);
}
// void RTMPPacket_Free(RTMPPacket* p);
// rtmp.c +203
func C_RTMPPacket_Free(p *C.RTMPPacket) {