rtmp: make C_HandleInvoke take a []byte

This commit is contained in:
Dan Kortschak 2018-09-19 14:05:42 +09:30
parent b1ecf52a44
commit 0eb66a6ece
1 changed files with 4 additions and 4 deletions

View File

@ -561,7 +561,7 @@ func C_RTMP_ClientPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
// 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);
if C_HandleInvoke(r, packet.m_body, packet.m_nBodySize) { if C_HandleInvoke(r, pl2b(packet.m_body, int(packet.m_nBodySize))) {
// This will never happen with the methods we implement. // This will never happen with the methods we implement.
log.Println("HasMediaPacket") log.Println("HasMediaPacket")
bHasMediaPacket = 2 bHasMediaPacket = 2
@ -1016,15 +1016,15 @@ func C_AV_erase(m []C_RTMP_METHOD, i int) []C_RTMP_METHOD {
// int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize); // int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize);
// rtmp.c +2912 // rtmp.c +2912
func C_HandleInvoke(r *C_RTMP, body *byte, nBodySize uint32) (ok bool) { func C_HandleInvoke(r *C_RTMP, body []byte) (ok bool) {
if *body != 0x02 { if body[0] != 0x02 {
// TODO use new logger here // TODO use new logger here
//RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", //RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet",
//__FUNCTION__); //__FUNCTION__);
return false return false
} }
var obj C_AMFObject var obj C_AMFObject
nRes := C_AMF_Decode(&obj, pl2b(body, int(nBodySize)), 0) nRes := C_AMF_Decode(&obj, body, 0)
if nRes < 0 { if nRes < 0 {
// TODO use new logger here // TODO use new logger here
//RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__); //RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);