Removed code we currently don't need in, C_RTMP_ClientPacket - tested and working

This commit is contained in:
saxon 2018-08-12 19:37:56 +09:30
parent 1c8e7b01fc
commit dc6e9a9a4b
1 changed files with 97 additions and 97 deletions

View File

@ -1724,8 +1724,8 @@ func C_RTMP_ConnectStream(r *C.RTMP, seekTime int32) int {
continue continue
} }
// TODO: port this //C.RTMP_ClientPacket(r, &packet)
C.RTMP_ClientPacket(r, &packet) C_RTMP_ClientPacket(r, &packet)
C_RTMPPacket_Free(&packet) C_RTMPPacket_Free(&packet)
} }
} }
@ -1734,37 +1734,38 @@ func C_RTMP_ConnectStream(r *C.RTMP, seekTime int32) int {
// int RTMP_ClientPacket() // int RTMP_ClientPacket()
// rtmp.c +1226 // rtmp.c +1226
// NOTE cases have been commented out that are not currently used by AusOcean
func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 { func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
var bHasMediaPacket int32 = 0 var bHasMediaPacket int32 = 0
switch packet.m_packetType { switch packet.m_packetType {
case RTMP_PACKET_TYPE_CHUNK_SIZE: case RTMP_PACKET_TYPE_CHUNK_SIZE:
/* chunk size */ log.Println("RTMP_PACKET_TYPE_CHUNK_SIZE")
// TODO: port this // TODO: port this
C.HandleChangeChunkSize(r, packet) C.HandleChangeChunkSize(r, packet)
/*
case RTMP_PACKET_TYPE_BYTES_READ_REPORT: case RTMP_PACKET_TYPE_BYTES_READ_REPORT:
/* bytes read report */ log.Println("RTMP_PACKET_TYPE_BYTES_READ_REPORT")
// TODO: usue new logger here // TODO: usue new logger here
//RTMP_Log(RTMP_LOGDEBUG, "%s, received: bytes read report", __FUNCTION__); //RTMP_Log(RTMP_LOGDEBUG, "%s, received: bytes read report", __FUNCTION__);
case RTMP_PACKET_TYPE_CONTROL: case RTMP_PACKET_TYPE_CONTROL:
/* ctrl */ log.Println("RTMP_PACKET_TYPE_CONTROL")
// TODO: port this // TODO: port this
C.HandleCtrl(r, packet) C.HandleCtrl(r, packet)
*/
case RTMP_PACKET_TYPE_SERVER_BW: case RTMP_PACKET_TYPE_SERVER_BW:
/* server bw */ log.Println("RTMP_PACKET_TYPE_SERVER_BW")
// TODO: port this // TODO: port this
C.HandleServerBW(r, packet) C.HandleServerBW(r, packet)
case RTMP_PACKET_TYPE_CLIENT_BW: case RTMP_PACKET_TYPE_CLIENT_BW:
/* client bw */ log.Println("RTMP_PACKET_TYPE_CLIENT_BW")
// TODO: port this // TODO: port this
C.HandleClientBW(r, packet) C.HandleClientBW(r, packet)
/*
case RTMP_PACKET_TYPE_AUDIO: case RTMP_PACKET_TYPE_AUDIO:
/* audio data */ log.Println("RTMP_PACKET_TYPE_AUDIO")
/*RTMP_Log(RTMP_LOGDEBUG, "%s, received: audio %lu bytes", __FUNCTION__, packet.m_nBodySize); */
// TODO port this // TODO port this
//C.HandleAudio(r, packet) NOTE this does nothing //C.HandleAudio(r, packet) NOTE this does nothing
bHasMediaPacket = 1 bHasMediaPacket = 1
@ -1777,8 +1778,7 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
} }
case RTMP_PACKET_TYPE_VIDEO: case RTMP_PACKET_TYPE_VIDEO:
/* video data */ log.Println("RTMP_PACKET_TYPE_VIDEO:")
/*RTMP_Log(RTMP_LOGDEBUG, "%s, received: video %lu bytes", __FUNCTION__, packet.m_nBodySize); */
// TODO port this // TODO port this
// C.HandleVideo(r, packet) NOTE this does nothing // C.HandleVideo(r, packet) NOTE this does nothing
bHasMediaPacket = 1 bHasMediaPacket = 1
@ -1790,7 +1790,7 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
} }
case RTMP_PACKET_TYPE_FLEX_MESSAGE: case RTMP_PACKET_TYPE_FLEX_MESSAGE:
/* flex message */ log.Println("RTMP_PACKET_TYPE_FLEX_MESSAGE:")
{ {
// TODO use new logger here // TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG,"%s, flex message, size %u bytes, not fully supported", __FUNCTION__, packet.m_nBodySize); // RTMP_Log(RTMP_LOGDEBUG,"%s, flex message, size %u bytes, not fully supported", __FUNCTION__, packet.m_nBodySize);
@ -1801,32 +1801,32 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
} }
} }
case RTMP_PACKET_TYPE_INFO: case RTMP_PACKET_TYPE_INFO:
/* metadata (notify) */ log.Println(" RTMP_PACKET_TYPE_INFO:")
// TODO use new logger here // TODO use new logger here
//RTMP_Log(RTMP_LOGDEBUG, "%s, received: notify %u bytes", __FUNCTION__,packet.m_nBodySize); //RTMP_Log(RTMP_LOGDEBUG, "%s, received: notify %u bytes", __FUNCTION__,packet.m_nBodySize);
if C.HandleMetadata(r, packet.m_body, C.uint(packet.m_nBodySize)) != 0 { if C.HandleMetadata(r, packet.m_body, C.uint(packet.m_nBodySize)) != 0 {
bHasMediaPacket = 1 bHasMediaPacket = 1
} }
*/
case RTMP_PACKET_TYPE_INVOKE: case RTMP_PACKET_TYPE_INVOKE:
/* invoke */ log.Println("RTMP_PACKET_TYPE_INVOKE:")
// TODO use new logger here // TODO use new logger here
//RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %u bytes", __FUNCTION__,packet.m_nBodySize); //RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %u bytes", __FUNCTION__,packet.m_nBodySize);
/*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */
if C.HandleInvoke(r, packet.m_body, C.uint(packet.m_nBodySize)) == 1 { if C.HandleInvoke(r, packet.m_body, C.uint(packet.m_nBodySize)) == 1 {
bHasMediaPacket = 2 bHasMediaPacket = 2
} }
/*
case RTMP_PACKET_TYPE_FLASH_VIDEO: case RTMP_PACKET_TYPE_FLASH_VIDEO:
log.Println("RTMP_PACKET_TYPE_FLASH_VIDEO:")
{ {
/* go through FLV packets and handle metadata packets */
var pos uint32 = 0 var pos uint32 = 0
var nTimeStamp uint32 = uint32(packet.m_nTimeStamp) var nTimeStamp uint32 = uint32(packet.m_nTimeStamp)
for pos+11 < uint32(packet.m_nBodySize) { for pos+11 < uint32(packet.m_nBodySize) {
var dataSize uint32 = C_AMF_DecodeInt24((*byte)(incBytePtr(unsafe.Pointer( var dataSize uint32 = C_AMF_DecodeInt24((*byte)(incBytePtr(unsafe.Pointer(
packet.m_body), int(pos+1)))) /* size without header (11) and prevTagSize (4) */ packet.m_body), int(pos+1))))
if pos+11+dataSize+4 > uint32(packet.m_nBodySize) { if pos+11+dataSize+4 > uint32(packet.m_nBodySize) {
// TODO use new logger here // TODO use new logger here
@ -1851,14 +1851,14 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
r.m_mediaStamp = C.uint32_t(nTimeStamp) r.m_mediaStamp = C.uint32_t(nTimeStamp)
} }
/* FLV tag(s) */
/*RTMP_Log(RTMP_LOGDEBUG, "%s, received: FLV tag(s) %lu bytes", __FUNCTION__, packet.m_nBodySize); */
bHasMediaPacket = 1 bHasMediaPacket = 1
} }
default: default:
log.Println("DEFAULT")
// TODO use new logger here // TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,packet.m_packetType); // RTMP_Log(RTMP_LOGDEBUG, "%s, unknown packet type received: 0x%02x", __FUNCTION__,packet.m_packetType);
*/
} }
return bHasMediaPacket return bHasMediaPacket
} }