rtmp: make C_RTMPSockBuf_Send take a []byte

This commit is contained in:
Dan Kortschak 2018-09-19 11:11:15 +09:30
parent bb6ee2a3ce
commit 7b69015873
1 changed files with 3 additions and 3 deletions

View File

@ -647,7 +647,7 @@ func C_WriteN(r *C_RTMP, buffer unsafe.Pointer, n int) (ok bool) {
for n > 0 {
var nBytes int
nBytes = int(C_RTMPSockBuf_Send(&r.m_sb, (*byte)(ptr), int32(n)))
nBytes = int(C_RTMPSockBuf_Send(&r.m_sb, pl2b((*byte)(ptr), n)))
if nBytes < 0 {
if debugMode {
@ -1817,8 +1817,8 @@ func C_RTMPSockBuf_Fill(sb *C_RTMPSockBuf) int {
// int RTMPSockBuf_Send(RTMPSockBuf* sb, const char* buf, int len);
// rtmp.c +4297
// TODO replace send with golang net connection send
func C_RTMPSockBuf_Send(sb *C_RTMPSockBuf, buf *byte, l int32) int32 {
return int32(C.send(C.int(sb.sb_socket), unsafe.Pointer(buf), C.size_t(l), 0))
func C_RTMPSockBuf_Send(sb *C_RTMPSockBuf, buf []byte) int32 {
return int32(C.send(C.int(sb.sb_socket), unsafe.Pointer(bAddr(buf)), C.ulong(len(buf)), 0))
}
// int