Ported RTMP_GetTime - tested and working

This commit is contained in:
saxon 2018-08-11 12:21:22 +09:30
parent c8c3b4b3aa
commit 6137df30b3
1 changed files with 9 additions and 1 deletions

View File

@ -67,6 +67,7 @@ import (
"reflect"
"strconv"
"strings"
"time"
"unsafe"
"github.com/chamaken/cgolmnl/inet"
@ -1186,7 +1187,8 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
clientbuf[0] = 0x03 // not encrypted
// TODO: port rtmp_getTime
uptime = inet.Htonl(uint32(C.RTMP_GetTime()))
//uptime = inet.Htonl(uint32(C.RTMP_GetTime()))
uptime = inet.Htonl(uint32(C_RTMP_GetTime()))
memmove(unsafe.Pointer(clientsig), unsafe.Pointer(&uptime), 4)
memset(indxBytePtr(unsafe.Pointer(clientsig), 4), 0, 4)
@ -1243,6 +1245,12 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
return 1
}
// uint32_t RTMP_GetTime();
// rtmp.c +156
func C_RTMP_GetTime() int32 {
return int32(time.Now().UnixNano() / 1000000)
}
// int ReadN(RTMP* r, char* buffer, int n);
// rtmp.c +1390
func C_ReadN(r *C.RTMP, buffer *byte, n int) int {