mirror of https://bitbucket.org/ausocean/av.git
rtmp: remove redundant comments
This commit is contained in:
parent
257544ef3f
commit
c31021149d
105
rtmp/rtmp.go
105
rtmp/rtmp.go
|
@ -142,23 +142,17 @@ var (
|
||||||
func startSession(rtmp *C_RTMP, u string, timeout uint32) (*C_RTMP, error) {
|
func startSession(rtmp *C_RTMP, u string, timeout uint32) (*C_RTMP, error) {
|
||||||
connect_timeout := int32(timeout)
|
connect_timeout := int32(timeout)
|
||||||
rtmp = C_RTMP_Alloc()
|
rtmp = C_RTMP_Alloc()
|
||||||
//rtmp = C.RTMP_Alloc()
|
|
||||||
C_RTMP_Init(rtmp)
|
C_RTMP_Init(rtmp)
|
||||||
//C.RTMP_Init(rtmp)
|
|
||||||
rtmp.Link.timeout = connect_timeout
|
rtmp.Link.timeout = connect_timeout
|
||||||
if C_RTMP_SetupURL(rtmp, u) == 0 {
|
if C_RTMP_SetupURL(rtmp, u) == 0 {
|
||||||
// if C.RTMP_SetupURL(rtmp, C.CString(u)) == 0 {
|
|
||||||
C_RTMP_Close(rtmp)
|
C_RTMP_Close(rtmp)
|
||||||
//C.RTMP_Free(rtmp)
|
//C.RTMP_Free(rtmp)
|
||||||
return nil, errors.New("rtmp startSession: Failed to setup URL!")
|
return nil, errors.New("rtmp startSession: Failed to setup URL!")
|
||||||
}
|
}
|
||||||
|
|
||||||
C_RTMP_EnableWrite(rtmp)
|
C_RTMP_EnableWrite(rtmp)
|
||||||
//C.RTMP_EnableWrite(rtmp)
|
|
||||||
C_RTMP_SetBufferMS(rtmp, 3600*1000)
|
C_RTMP_SetBufferMS(rtmp, 3600*1000)
|
||||||
//C.RTMP_SetBufferMS(rtmp, 3600*1000)
|
|
||||||
if C_RTMP_Connect(rtmp, nil) == 0 {
|
if C_RTMP_Connect(rtmp, nil) == 0 {
|
||||||
//if C.RTMP_Connect(rtmp, nil) == 0 {
|
|
||||||
C_RTMP_Close(rtmp)
|
C_RTMP_Close(rtmp)
|
||||||
//C.RTMP_Free(rtmp)
|
//C.RTMP_Free(rtmp)
|
||||||
return nil, errors.New("rtmp startSession: Failed to connect!")
|
return nil, errors.New("rtmp startSession: Failed to connect!")
|
||||||
|
@ -166,7 +160,6 @@ func startSession(rtmp *C_RTMP, u string, timeout uint32) (*C_RTMP, error) {
|
||||||
|
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
if C_RTMP_ConnectStream(rtmp, 0) == 0 {
|
if C_RTMP_ConnectStream(rtmp, 0) == 0 {
|
||||||
//if C.RTMP_ConnectStream(rtmp, 0) == 0 {
|
|
||||||
C_RTMP_Close(rtmp)
|
C_RTMP_Close(rtmp)
|
||||||
//C.RTMP_Free(rtmp)
|
//C.RTMP_Free(rtmp)
|
||||||
return nil, errors.New("rtmp startSession: Failed to connect stream!")
|
return nil, errors.New("rtmp startSession: Failed to connect stream!")
|
||||||
|
@ -216,7 +209,6 @@ func C_RTMPPacket_Alloc(p *C_RTMPPacket, nSize uint32) int {
|
||||||
// rtmp.c +203
|
// rtmp.c +203
|
||||||
func C_RTMPPacket_Free(p *C_RTMPPacket) {
|
func C_RTMPPacket_Free(p *C_RTMPPacket) {
|
||||||
if p.m_body != nil {
|
if p.m_body != nil {
|
||||||
//C.free(decBytePtr(unsafe.Pointer(p.m_body), RTMP_MAX_HEADER_SIZE))
|
|
||||||
p.m_body = nil
|
p.m_body = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +217,6 @@ func C_RTMPPacket_Free(p *C_RTMPPacket) {
|
||||||
// rtmp.c +317
|
// rtmp.c +317
|
||||||
func C_RTMP_Alloc() *C_RTMP {
|
func C_RTMP_Alloc() *C_RTMP {
|
||||||
return &C_RTMP{}
|
return &C_RTMP{}
|
||||||
//return (*C_RTMP)(allocate(unsafe.Sizeof(r)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void RTMP_Init(RTMP *r);
|
// void RTMP_Init(RTMP *r);
|
||||||
|
@ -309,8 +300,6 @@ func C_RTMP_SetupURL(r *C_RTMP, u string) int32 {
|
||||||
|
|
||||||
length = strlen(url)
|
length = strlen(url)
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
//ret = int32(C.RTMP_ParseURL((*byte)(unsafe.Pointer(url)), &r.Link.protocol,
|
|
||||||
// &r.Link.hostname, (*C.uint)(&port), &r.Link.playpath0, &r.Link.app))
|
|
||||||
ret = int32(C_RTMP_ParseURL((*byte)(unsafe.Pointer(url)), (*int32)(
|
ret = int32(C_RTMP_ParseURL((*byte)(unsafe.Pointer(url)), (*int32)(
|
||||||
unsafe.Pointer(&r.Link.protocol)), &r.Link.hostname, (*uint32)(
|
unsafe.Pointer(&r.Link.protocol)), &r.Link.hostname, (*uint32)(
|
||||||
unsafe.Pointer(&port)), &r.Link.playpath0, &r.Link.app))
|
unsafe.Pointer(&port)), &r.Link.playpath0, &r.Link.app))
|
||||||
|
@ -416,7 +405,6 @@ func C_RTMP_Connect0(r *C_RTMP, service *C.sockaddr) int {
|
||||||
log.Println("C_RTMP_Connect0: socks negotiation.")
|
log.Println("C_RTMP_Connect0: socks negotiation.")
|
||||||
}
|
}
|
||||||
|
|
||||||
//if C.SocksNegotiate(r) == 0 {
|
|
||||||
if C_SocksNegotiate(r) == 0 {
|
if C_SocksNegotiate(r) == 0 {
|
||||||
log.Println("C_RTMP_Connect0: SOCKS negotiation failed.")
|
log.Println("C_RTMP_Connect0: SOCKS negotiation failed.")
|
||||||
return 0
|
return 0
|
||||||
|
@ -430,7 +418,6 @@ func C_RTMP_Connect0(r *C_RTMP, service *C.sockaddr) int {
|
||||||
{
|
{
|
||||||
var tv int32
|
var tv int32
|
||||||
SET_RCVTIMEO(&tv, int32(r.Link.timeout))
|
SET_RCVTIMEO(&tv, int32(r.Link.timeout))
|
||||||
// tv := int32(r.Link.timeout * 1000)
|
|
||||||
|
|
||||||
if C.setsockopt(C.int(r.m_sb.sb_socket), C.SOL_SOCKET, C.SO_RCVTIMEO,
|
if C.setsockopt(C.int(r.m_sb.sb_socket), C.SOL_SOCKET, C.SO_RCVTIMEO,
|
||||||
unsafe.Pointer(&tv), C.socklen_t(unsafe.Sizeof(tv))) != 0 {
|
unsafe.Pointer(&tv), C.socklen_t(unsafe.Sizeof(tv))) != 0 {
|
||||||
|
@ -450,7 +437,6 @@ func C_RTMP_Connect1(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
if debugMode {
|
if debugMode {
|
||||||
log.Println("... connected, handshaking...")
|
log.Println("... connected, handshaking...")
|
||||||
}
|
}
|
||||||
//if C.HandShake(r, 1) == 0 {
|
|
||||||
if C_HandShake(r, 1) == 0 {
|
if C_HandShake(r, 1) == 0 {
|
||||||
log.Println("C_RTMP_Connect1: handshake failed!")
|
log.Println("C_RTMP_Connect1: handshake failed!")
|
||||||
return 0
|
return 0
|
||||||
|
@ -458,7 +444,6 @@ func C_RTMP_Connect1(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
if debugMode {
|
if debugMode {
|
||||||
log.Println("... handshaked...")
|
log.Println("... handshaked...")
|
||||||
}
|
}
|
||||||
//if C.SendConnectPacket(r, cp) == 0 {
|
|
||||||
if C_SendConnectPacket(r, cp) == 0 {
|
if C_SendConnectPacket(r, cp) == 0 {
|
||||||
log.Println("RTMP connect failed!")
|
log.Println("RTMP connect failed!")
|
||||||
return 0
|
return 0
|
||||||
|
@ -491,7 +476,6 @@ func C_RTMP_Connect(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if C.RTMP_Connect0(r, (*C.sockaddr)(unsafe.Pointer(&service))) == 0 {
|
|
||||||
if C_RTMP_Connect0(r, (*C.sockaddr)(unsafe.Pointer(&service))) == 0 {
|
if C_RTMP_Connect0(r, (*C.sockaddr)(unsafe.Pointer(&service))) == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -499,7 +483,6 @@ func C_RTMP_Connect(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
r.m_bSendCounter = 1
|
r.m_bSendCounter = 1
|
||||||
|
|
||||||
return int(C_RTMP_Connect1(r, cp))
|
return int(C_RTMP_Connect1(r, cp))
|
||||||
//return int(C.RTMP_Connect1(r, cp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// int SocksNegotiate(RTMP* r);
|
// int SocksNegotiate(RTMP* r);
|
||||||
|
@ -553,7 +536,6 @@ func C_RTMP_ConnectStream(r *C_RTMP, seekTime int32) int {
|
||||||
|
|
||||||
// TODO: read packet
|
// TODO: read packet
|
||||||
for r.m_bPlaying == 0 && C_RTMP_IsConnected(r) != 0 &&
|
for r.m_bPlaying == 0 && C_RTMP_IsConnected(r) != 0 &&
|
||||||
//C.RTMP_ReadPacket(r, &packet) != 0 {
|
|
||||||
C_RTMP_ReadPacket(r, &packet) != 0 {
|
C_RTMP_ReadPacket(r, &packet) != 0 {
|
||||||
|
|
||||||
// TODO: port is ready
|
// TODO: port is ready
|
||||||
|
@ -570,7 +552,6 @@ func C_RTMP_ConnectStream(r *C_RTMP, seekTime int32) int {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
//C.RTMP_ClientPacket(r, &packet)
|
|
||||||
C_RTMP_ClientPacket(r, &packet)
|
C_RTMP_ClientPacket(r, &packet)
|
||||||
C_RTMPPacket_Free(&packet)
|
C_RTMPPacket_Free(&packet)
|
||||||
}
|
}
|
||||||
|
@ -587,7 +568,6 @@ func C_RTMP_ClientPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
|
||||||
|
|
||||||
case RTMP_PACKET_TYPE_CHUNK_SIZE:
|
case RTMP_PACKET_TYPE_CHUNK_SIZE:
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
//C.HandleChangeChunkSize(r, packet)
|
|
||||||
C_HandleChangeChunkSize(r, packet)
|
C_HandleChangeChunkSize(r, packet)
|
||||||
|
|
||||||
case RTMP_PACKET_TYPE_BYTES_READ_REPORT:
|
case RTMP_PACKET_TYPE_BYTES_READ_REPORT:
|
||||||
|
@ -603,12 +583,10 @@ func C_RTMP_ClientPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
|
||||||
*/
|
*/
|
||||||
case RTMP_PACKET_TYPE_SERVER_BW:
|
case RTMP_PACKET_TYPE_SERVER_BW:
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
//C.HandleServerBW(r, packet)
|
|
||||||
C_HandlServerBW(r, packet)
|
C_HandlServerBW(r, packet)
|
||||||
|
|
||||||
case RTMP_PACKET_TYPE_CLIENT_BW:
|
case RTMP_PACKET_TYPE_CLIENT_BW:
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
//C.HandleClientBW(r, packet)
|
|
||||||
C_HandleClientBW(r, packet)
|
C_HandleClientBW(r, packet)
|
||||||
|
|
||||||
case RTMP_PACKET_TYPE_AUDIO:
|
case RTMP_PACKET_TYPE_AUDIO:
|
||||||
|
@ -628,7 +606,6 @@ 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, C.uint(packet.m_nBodySize)) == 1 {
|
|
||||||
if C_HandleInvoke(r, (*byte)(unsafe.Pointer(packet.m_body)), uint32(packet.m_nBodySize)) == 1 {
|
if C_HandleInvoke(r, (*byte)(unsafe.Pointer(packet.m_body)), uint32(packet.m_nBodySize)) == 1 {
|
||||||
log.Println("HasMediaPacket")
|
log.Println("HasMediaPacket")
|
||||||
bHasMediaPacket = 2
|
bHasMediaPacket = 2
|
||||||
|
@ -662,7 +639,6 @@ func C_ReadN(r *C_RTMP, buffer *byte, n int) int {
|
||||||
avail = int(r.m_sb.sb_size)
|
avail = int(r.m_sb.sb_size)
|
||||||
if avail == 0 {
|
if avail == 0 {
|
||||||
if C_RTMPSockBuf_Fill(&r.m_sb) < 1 {
|
if C_RTMPSockBuf_Fill(&r.m_sb) < 1 {
|
||||||
// if C.RTMPSockBuf_Fill(&r.m_sb) < 1 {
|
|
||||||
if r.m_sb.sb_timedout == 0 {
|
if r.m_sb.sb_timedout == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -685,7 +661,6 @@ func C_ReadN(r *C_RTMP, buffer *byte, n int) int {
|
||||||
r.m_nBytesIn += int32(nRead)
|
r.m_nBytesIn += int32(nRead)
|
||||||
if r.m_bSendCounter != 0 && r.m_nBytesIn > (r.m_nBytesInSent+
|
if r.m_bSendCounter != 0 && r.m_nBytesIn > (r.m_nBytesInSent+
|
||||||
r.m_nClientBW/10) {
|
r.m_nClientBW/10) {
|
||||||
//if C.SendBytesReceived(r) == 0 {
|
|
||||||
if C_SendBytesReceived(r) == 0 {
|
if C_SendBytesReceived(r) == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -750,7 +725,6 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
|
|
||||||
if cp != nil {
|
if cp != nil {
|
||||||
return C_RTMP_SendPacket(r, cp, 1)
|
return C_RTMP_SendPacket(r, cp, 1)
|
||||||
//return int(C.RTMP_SendPacket(r, cp, 1))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
packet.m_nChannel = 0x03
|
packet.m_nChannel = 0x03
|
||||||
|
@ -764,45 +738,33 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
|
|
||||||
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
||||||
|
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeString((*byte)(unsafe.Pointer(enc)),
|
|
||||||
//(*byte)(unsafe.Pointer(pend)), &av_connect)))
|
|
||||||
enc = C_AMF_EncodeString(enc, pend, &av_connect)
|
enc = C_AMF_EncodeString(enc, pend, &av_connect)
|
||||||
|
|
||||||
r.m_numInvokes += 1
|
r.m_numInvokes += 1
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNumber((*byte)(unsafe.Pointer(enc)),
|
|
||||||
//(*byte)(unsafe.Pointer(pend)), float64(r.m_numInvokes))))
|
|
||||||
enc = C_AMF_EncodeNumber(enc, pend, float64(r.m_numInvokes))
|
enc = C_AMF_EncodeNumber(enc, pend, float64(r.m_numInvokes))
|
||||||
|
|
||||||
(*[_Gi]byte)(unsafe.Pointer(enc))[0] = AMF_OBJECT
|
(*[_Gi]byte)(unsafe.Pointer(enc))[0] = AMF_OBJECT
|
||||||
|
|
||||||
enc = (*byte)(unsafe.Pointer(incBytePtr(unsafe.Pointer(enc), 1)))
|
enc = (*byte)(unsafe.Pointer(incBytePtr(unsafe.Pointer(enc), 1)))
|
||||||
|
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_app, &r.Link.app)))
|
|
||||||
enc = C_AMF_EncodeNamedString(enc, pend, &av_app, &r.Link.app)
|
enc = C_AMF_EncodeNamedString(enc, pend, &av_app, &r.Link.app)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if r.Link.protocol&RTMP_FEATURE_WRITE != 0 {
|
if r.Link.protocol&RTMP_FEATURE_WRITE != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_type, &av_nonprivate)))
|
|
||||||
enc = C_AMF_EncodeNamedString(enc, pend, &av_type, &av_nonprivate)
|
enc = C_AMF_EncodeNamedString(enc, pend, &av_type, &av_nonprivate)
|
||||||
|
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Link.flashVer.av_len != 0 {
|
if r.Link.flashVer.av_len != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_flashVer, &r.Link.flashVer)))
|
|
||||||
enc = C_AMF_EncodeNamedString(enc, pend, &av_flashVer, &r.Link.flashVer)
|
enc = C_AMF_EncodeNamedString(enc, pend, &av_flashVer, &r.Link.flashVer)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if r.Link.swfUrl.av_len != 0 {
|
if r.Link.swfUrl.av_len != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*byte)(
|
|
||||||
// unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_swfUrl, &r.Link.swfUrl)))
|
|
||||||
enc = C_AMF_EncodeNamedString(enc, pend, &av_swfUrl, &r.Link.swfUrl)
|
enc = C_AMF_EncodeNamedString(enc, pend, &av_swfUrl, &r.Link.swfUrl)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -810,8 +772,6 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Link.tcUrl.av_len != 0 {
|
if r.Link.tcUrl.av_len != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_tcUrl, &r.Link.tcUrl)))
|
|
||||||
enc = C_AMF_EncodeNamedString(enc, pend, &av_tcUrl, &r.Link.tcUrl)
|
enc = C_AMF_EncodeNamedString(enc, pend, &av_tcUrl, &r.Link.tcUrl)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -819,39 +779,27 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Link.protocol&RTMP_FEATURE_WRITE == 0 {
|
if r.Link.protocol&RTMP_FEATURE_WRITE == 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedBoolean((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_fpad, 0)))
|
|
||||||
enc = C_AMF_EncodeNamedBoolean(enc, pend, &av_fpad, 0)
|
enc = C_AMF_EncodeNamedBoolean(enc, pend, &av_fpad, 0)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_capabilities, 15.0)))
|
|
||||||
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 15.0)
|
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 15.0)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*byte)(
|
|
||||||
// unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_audioCodecs, r.m_fAudioCodecs)))
|
|
||||||
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_audioCodecs, float64(r.m_fAudioCodecs))
|
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_audioCodecs, float64(r.m_fAudioCodecs))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_videoCodecs, r.m_fVideoCodecs)))
|
|
||||||
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_videoCodecs, float64(r.m_fVideoCodecs))
|
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_videoCodecs, float64(r.m_fVideoCodecs))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*byte)(
|
|
||||||
// unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_videoFunction, 1.0)))
|
|
||||||
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_videoFunction, 1.0)
|
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_videoFunction, 1.0)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if r.Link.pageUrl.av_len != 0 {
|
if r.Link.pageUrl.av_len != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_pageUrl, &r.Link.pageUrl)))
|
|
||||||
enc = C_AMF_EncodeNamedString(enc, pend, &av_pageUrl, &r.Link.pageUrl)
|
enc = C_AMF_EncodeNamedString(enc, pend, &av_pageUrl, &r.Link.pageUrl)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -860,8 +808,6 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.m_fEncoding != 0.0 || r.m_bSendEncoding != 0 {
|
if r.m_fEncoding != 0.0 || r.m_bSendEncoding != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*byte)(
|
|
||||||
//unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), &av_objectEncoding, r.m_fEncoding)))
|
|
||||||
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_objectEncoding, float64(r.m_fEncoding))
|
enc = C_AMF_EncodeNamedNumber(enc, pend, &av_objectEncoding, float64(r.m_fEncoding))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -882,14 +828,10 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
|
|
||||||
/* add auth string */
|
/* add auth string */
|
||||||
if r.Link.auth.av_len != 0 {
|
if r.Link.auth.av_len != 0 {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeBoolean((*byte)(
|
|
||||||
// unsafe.Pointer(enc)), (*byte)(unsafe.Pointer(pend)), r.Link.lFlags&RTMP_LF_AUTH)))
|
|
||||||
enc = C_AMF_EncodeBoolean(enc, pend, int(r.Link.lFlags&RTMP_LF_AUTH))
|
enc = C_AMF_EncodeBoolean(enc, pend, int(r.Link.lFlags&RTMP_LF_AUTH))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMF_EncodeString((*byte)(unsafe.Pointer(enc)),
|
|
||||||
//(*byte)(unsafe.Pointer(pend)), &r.Link.auth)))
|
|
||||||
enc = C_AMF_EncodeString(enc, (*byte)(pend), &r.Link.auth)
|
enc = C_AMF_EncodeString(enc, (*byte)(pend), &r.Link.auth)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -898,10 +840,6 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
|
|
||||||
if r.Link.extras.o_num != 0 {
|
if r.Link.extras.o_num != 0 {
|
||||||
for i := 0; i < int(r.Link.extras.o_num); i++ {
|
for i := 0; i < int(r.Link.extras.o_num); i++ {
|
||||||
//enc = (*byte)(unsafe.Pointer(C.AMFProp_Encode((*C_AMFObjectProperty)(
|
|
||||||
//incPtr(unsafe.Pointer(&r.Link.extras.o_props), int(unsafe.Sizeof(
|
|
||||||
//r.Link.extras.o_props)), i)), (*byte)(unsafe.Pointer(enc)), (*byte)(
|
|
||||||
//unsafe.Pointer(pend)))))
|
|
||||||
enc = C_AMF_PropEncode((*C_AMFObjectProperty)(incPtr(unsafe.Pointer(
|
enc = C_AMF_PropEncode((*C_AMFObjectProperty)(incPtr(unsafe.Pointer(
|
||||||
&r.Link.extras.o_props), int(unsafe.Sizeof(r.Link.extras.o_props)), i)),
|
&r.Link.extras.o_props), int(unsafe.Sizeof(r.Link.extras.o_props)), i)),
|
||||||
enc, pend)
|
enc, pend)
|
||||||
|
@ -915,7 +853,6 @@ func C_SendConnectPacket(r *C_RTMP, cp *C_RTMPPacket) int {
|
||||||
packet.m_nBodySize = uint32(uintptr(decBytePtr(unsafe.Pointer(enc),
|
packet.m_nBodySize = uint32(uintptr(decBytePtr(unsafe.Pointer(enc),
|
||||||
int(uintptr(unsafe.Pointer(packet.m_body))))))
|
int(uintptr(unsafe.Pointer(packet.m_body))))))
|
||||||
|
|
||||||
//return int(C.RTMP_SendPacket(r, &packet, 1))
|
|
||||||
return C_RTMP_SendPacket(r, &packet, 1)
|
return C_RTMP_SendPacket(r, &packet, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1114,11 +1051,9 @@ func C_SendBytesReceived(r *C_RTMP) int {
|
||||||
packet.m_nBodySize = 4
|
packet.m_nBodySize = 4
|
||||||
|
|
||||||
C_AMF_EncodeInt32((*byte)(unsafe.Pointer(packet.m_body)), pend, int32(r.m_nBytesIn))
|
C_AMF_EncodeInt32((*byte)(unsafe.Pointer(packet.m_body)), pend, int32(r.m_nBytesIn))
|
||||||
// C.AMF_EncodeInt32(packet.m_body, (*byte)(unsafe.Pointer(pend)), r.m_nBytesIn)
|
|
||||||
|
|
||||||
r.m_nBytesInSent = r.m_nBytesIn
|
r.m_nBytesInSent = r.m_nBytesIn
|
||||||
|
|
||||||
//return int(C.RTMP_SendPacket(r, &packet, 0))
|
|
||||||
return C_RTMP_SendPacket(r, &packet, 0)
|
return C_RTMP_SendPacket(r, &packet, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,8 +1113,6 @@ func C_AV_erase(vals *C_RTMP_METHOD, num *int32, i, freeit int32) {
|
||||||
// rtmp.c +2414
|
// rtmp.c +2414
|
||||||
func C_AV_queue(vals **C_RTMP_METHOD, num *int32, av *C_AVal, txn int32) {
|
func C_AV_queue(vals **C_RTMP_METHOD, num *int32, av *C_AVal, txn int32) {
|
||||||
if (*num & 0x0f) == 0 {
|
if (*num & 0x0f) == 0 {
|
||||||
//*vals = (*C_RTMP_METHOD)(realloc(unsafe.Pointer(*vals), uint32((*num+16)*
|
|
||||||
//int32(unsafe.Sizeof(*(*vals))))))
|
|
||||||
*vals = (*C_RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16)*
|
*vals = (*C_RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16)*
|
||||||
int32(unsafe.Sizeof(*(*vals))))))
|
int32(unsafe.Sizeof(*(*vals))))))
|
||||||
}
|
}
|
||||||
|
@ -1213,7 +1146,6 @@ func C_HandleInvoke(r *C_RTMP, body *byte, nBodySize uint32) int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
nRes = C_AMF_Decode(&obj, body, int32(nBodySize), 0)
|
nRes = C_AMF_Decode(&obj, body, int32(nBodySize), 0)
|
||||||
//nRes = int32(C.AMF_Decode(&obj, (*byte)(unsafe.Pointer(body)), int32(nBodySize), 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__);
|
||||||
|
@ -1238,7 +1170,6 @@ func C_HandleInvoke(r *C_RTMP, body *byte, nBodySize uint32) int32 {
|
||||||
int(unsafe.Sizeof(*r.m_methodCalls))))).num) == txn {
|
int(unsafe.Sizeof(*r.m_methodCalls))))).num) == txn {
|
||||||
methodInvoked = (*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(r.m_methodCalls),
|
methodInvoked = (*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(r.m_methodCalls),
|
||||||
int(i), int(unsafe.Sizeof(*r.m_methodCalls))))).name
|
int(i), int(unsafe.Sizeof(*r.m_methodCalls))))).name
|
||||||
//C.AV_erase(r.m_methodCalls, &r.m_numCalls, int32(i), 0)
|
|
||||||
C_AV_erase(r.m_methodCalls, (*int32)(&r.m_numCalls), int32(i), 0)
|
C_AV_erase(r.m_methodCalls, (*int32)(&r.m_numCalls), int32(i), 0)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -1332,7 +1263,6 @@ func C_HandleInvoke(r *C_RTMP, body *byte, nBodySize uint32) int32 {
|
||||||
for i = 0; i < int32(r.m_numCalls); i++ {
|
for i = 0; i < int32(r.m_numCalls); i++ {
|
||||||
if C_AVMATCH(&(*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(r.m_methodCalls), int(i),
|
if C_AVMATCH(&(*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(r.m_methodCalls), int(i),
|
||||||
int(unsafe.Sizeof(*r.m_methodCalls))))).name, &av_publish) != 0 {
|
int(unsafe.Sizeof(*r.m_methodCalls))))).name, &av_publish) != 0 {
|
||||||
//C.AV_erase(r.m_methodCalls, &r.m_numCalls, int32(i), 1)
|
|
||||||
C_AV_erase(r.m_methodCalls, (*int32)(&r.m_numCalls), int32(i), 1)
|
C_AV_erase(r.m_methodCalls, (*int32)(&r.m_numCalls), int32(i), 1)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -1375,7 +1305,6 @@ func C_HandleChangeChunkSize(r *C_RTMP, packet *C_RTMPPacket) {
|
||||||
// rtmp.c +3508
|
// rtmp.c +3508
|
||||||
func C_HandlServerBW(r *C_RTMP, packet *C_RTMPPacket) {
|
func C_HandlServerBW(r *C_RTMP, packet *C_RTMPPacket) {
|
||||||
r.m_nServerBW = int32(C_AMF_DecodeInt32((*byte)(unsafe.Pointer(packet.m_body))))
|
r.m_nServerBW = int32(C_AMF_DecodeInt32((*byte)(unsafe.Pointer(packet.m_body))))
|
||||||
//r.m_nServerBW = int32(C.AMF_DecodeInt32((*byte)(unsafe.Pointer(packet.m_body))))
|
|
||||||
// TODO use new logger here
|
// TODO use new logger here
|
||||||
// RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r.m_nServerBW);
|
// RTMP_Log(RTMP_LOGDEBUG, "%s: server BW = %d", __FUNCTION__, r.m_nServerBW);
|
||||||
}
|
}
|
||||||
|
@ -1465,14 +1394,10 @@ func C_RTMP_ReadPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
|
||||||
|
|
||||||
if packet.m_nChannel >= r.m_channelsAllocatedIn {
|
if packet.m_nChannel >= r.m_channelsAllocatedIn {
|
||||||
var n int32 = int32(packet.m_nChannel + 10)
|
var n int32 = int32(packet.m_nChannel + 10)
|
||||||
//timestamp := (*int32)(realloc(unsafe.Pointer(r.m_channelTimestamp),
|
|
||||||
//uint32(int32(unsafe.Sizeof(n))*n)))
|
|
||||||
timestamp := (*int32)(C.realloc(unsafe.Pointer(r.m_channelTimestamp),
|
timestamp := (*int32)(C.realloc(unsafe.Pointer(r.m_channelTimestamp),
|
||||||
C.size_t(int32(unsafe.Sizeof(n))*n)))
|
C.size_t(int32(unsafe.Sizeof(n))*n)))
|
||||||
|
|
||||||
var packetPtr *C_RTMPPacket
|
var packetPtr *C_RTMPPacket
|
||||||
//packets := (**C_RTMPPacket)(realloc(unsafe.Pointer(r.m_vecChannelsIn),
|
|
||||||
//uint32(int32(unsafe.Sizeof(packetPtr))*n)))
|
|
||||||
packets := (**C_RTMPPacket)(C.realloc(unsafe.Pointer(r.m_vecChannelsIn),
|
packets := (**C_RTMPPacket)(C.realloc(unsafe.Pointer(r.m_vecChannelsIn),
|
||||||
C.size_t(int32(unsafe.Sizeof(packetPtr))*n)))
|
C.size_t(int32(unsafe.Sizeof(packetPtr))*n)))
|
||||||
if timestamp == nil {
|
if timestamp == nil {
|
||||||
|
@ -1540,8 +1465,6 @@ func C_RTMP_ReadPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
packet.m_nInfoField2 = int32(C_DecodeInt32LE((*byte)(incBytePtr(
|
packet.m_nInfoField2 = int32(C_DecodeInt32LE((*byte)(incBytePtr(
|
||||||
unsafe.Pointer(header), 7))))
|
unsafe.Pointer(header), 7))))
|
||||||
//packet.m_nInfoField2 = int32(C.DecodeInt32LE((*byte)(incBytePtr(
|
|
||||||
//unsafe.Pointer(header), 7))))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1559,8 +1482,6 @@ func C_RTMP_ReadPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
packet.m_nTimeStamp = uint32(C_AMF_DecodeInt32((*byte)(incBytePtr(
|
packet.m_nTimeStamp = uint32(C_AMF_DecodeInt32((*byte)(incBytePtr(
|
||||||
unsafe.Pointer(header), int(nSize)))))
|
unsafe.Pointer(header), int(nSize)))))
|
||||||
//packet.m_nTimeStamp = uint32(C.AMF_DecodeInt32((*byte)(incBytePtr(
|
|
||||||
//unsafe.Pointer(header), int(nSize)))))
|
|
||||||
hSize += 4
|
hSize += 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1643,9 +1564,6 @@ func C_RTMP_ReadPacket(r *C_RTMP, packet *C_RTMPPacket) int32 {
|
||||||
// rtmp.c +3744
|
// rtmp.c +3744
|
||||||
func C_HandShake(r *C_RTMP, FP9HandShake int32) int {
|
func C_HandShake(r *C_RTMP, FP9HandShake int32) int {
|
||||||
var bMatch int
|
var bMatch int
|
||||||
//uptime := uint32(0)
|
|
||||||
//suptime := uint32(0)
|
|
||||||
//typ := byte(0)
|
|
||||||
var uptime, suptime uint32
|
var uptime, suptime uint32
|
||||||
var typ byte
|
var typ byte
|
||||||
//clientbuf := make([]byte, RTMP_SIG_SIZE+1)
|
//clientbuf := make([]byte, RTMP_SIG_SIZE+1)
|
||||||
|
@ -1657,7 +1575,6 @@ func C_HandShake(r *C_RTMP, FP9HandShake int32) int {
|
||||||
clientbuf[0] = 0x03 // not encrypted
|
clientbuf[0] = 0x03 // not encrypted
|
||||||
|
|
||||||
// TODO: port rtmp_getTime
|
// 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)
|
memmove(unsafe.Pointer(clientsig), unsafe.Pointer(&uptime), 4)
|
||||||
|
|
||||||
|
@ -1732,8 +1649,6 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) int {
|
||||||
n := int(packet.m_nChannel + 10)
|
n := int(packet.m_nChannel + 10)
|
||||||
packets = C.realloc(unsafe.Pointer(r.m_vecChannelsOut), C.size_t(
|
packets = C.realloc(unsafe.Pointer(r.m_vecChannelsOut), C.size_t(
|
||||||
unsafe.Sizeof(packet)*uintptr(n)))
|
unsafe.Sizeof(packet)*uintptr(n)))
|
||||||
//packets = realloc(unsafe.Pointer(r.m_vecChannelsOut),
|
|
||||||
//uint32(unsafe.Sizeof(packet)*uintptr(n)))
|
|
||||||
|
|
||||||
if uintptr(packets) == uintptr(0) {
|
if uintptr(packets) == uintptr(0) {
|
||||||
//C.free(unsafe.Pointer(r.m_vecChannelsOut))
|
//C.free(unsafe.Pointer(r.m_vecChannelsOut))
|
||||||
|
@ -1747,9 +1662,6 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) int {
|
||||||
int(unsafe.Sizeof(packet)))), 0, int(unsafe.Sizeof(packet)*
|
int(unsafe.Sizeof(packet)))), 0, int(unsafe.Sizeof(packet)*
|
||||||
uintptr(n-int(r.m_channelsAllocatedOut))))
|
uintptr(n-int(r.m_channelsAllocatedOut))))
|
||||||
|
|
||||||
//memset((*byte)(incPtr(unsafe.Pointer(r.m_vecChannelsOut), int(
|
|
||||||
// r.m_channelsAllocatedOut), int(unsafe.Sizeof(packet)))), 0, int(
|
|
||||||
// unsafe.Sizeof(packet)*uintptr(n-int(r.m_channelsAllocatedOut))))
|
|
||||||
r.m_channelsAllocatedOut = int32(n)
|
r.m_channelsAllocatedOut = int32(n)
|
||||||
}
|
}
|
||||||
prevPacket = *(**C_RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
|
prevPacket = *(**C_RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
|
||||||
|
@ -1853,8 +1765,6 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) int {
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
hptr = incBytePtr(hptr, int(C_EncodeInt32LE((*byte)(hptr),
|
hptr = incBytePtr(hptr, int(C_EncodeInt32LE((*byte)(hptr),
|
||||||
int32(packet.m_nInfoField2))))
|
int32(packet.m_nInfoField2))))
|
||||||
//hptr = incBytePtr(hptr, int(C.EncodeInt32LE((*byte)(hptr),
|
|
||||||
//int32(packet.m_nInfoField2))))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if t >= 0xffffff {
|
if t >= 0xffffff {
|
||||||
|
@ -1877,7 +1787,6 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if tbuf != nil {
|
if tbuf != nil {
|
||||||
//memmove(toff, header, uintptr(nChunkSize + hSize))
|
|
||||||
copy((*[_Gi]byte)(toff)[:nChunkSize+hSize], (*[_Gi]byte)(header)[:nChunkSize+hSize])
|
copy((*[_Gi]byte)(toff)[:nChunkSize+hSize], (*[_Gi]byte)(header)[:nChunkSize+hSize])
|
||||||
toff = incBytePtr(toff, nChunkSize+hSize)
|
toff = incBytePtr(toff, nChunkSize+hSize)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1943,7 +1852,6 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) int {
|
||||||
var method C_AVal
|
var method C_AVal
|
||||||
var ptr unsafe.Pointer
|
var ptr unsafe.Pointer
|
||||||
ptr = incBytePtr(unsafe.Pointer(packet.m_body), 1)
|
ptr = incBytePtr(unsafe.Pointer(packet.m_body), 1)
|
||||||
//C.AMF_DecodeString((*byte)(ptr), &method)
|
|
||||||
C_AMF_DecodeString((*byte)(ptr), &method)
|
C_AMF_DecodeString((*byte)(ptr), &method)
|
||||||
|
|
||||||
if debugMode {
|
if debugMode {
|
||||||
|
@ -1953,12 +1861,9 @@ func C_RTMP_SendPacket(r *C_RTMP, packet *C_RTMPPacket, queue int) int {
|
||||||
if queue != 0 {
|
if queue != 0 {
|
||||||
var txn int
|
var txn int
|
||||||
ptr = incBytePtr(ptr, 3+int(method.av_len))
|
ptr = incBytePtr(ptr, 3+int(method.av_len))
|
||||||
//txn = int(C.AMF_DecodeNumber((*byte)(ptr)))
|
|
||||||
txn = int(C_AMF_DecodeNumber((*byte)(ptr)))
|
txn = int(C_AMF_DecodeNumber((*byte)(ptr)))
|
||||||
C_AV_queue(&r.m_methodCalls, (*int32)(unsafe.Pointer(&r.m_numCalls)),
|
C_AV_queue(&r.m_methodCalls, (*int32)(unsafe.Pointer(&r.m_numCalls)),
|
||||||
&method, int32(txn))
|
&method, int32(txn))
|
||||||
//C.AV_queue(&r.m_methodCalls, (*int32)(unsafe.Pointer(&r.m_numCalls)), &method,
|
|
||||||
//int32(txn))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2182,7 +2087,6 @@ func C_RTMP_Write(r *C_RTMP, buf []byte) int {
|
||||||
// TODO: Port this
|
// TODO: Port this
|
||||||
ret = C_RTMP_SendPacket(r, pkt, 0)
|
ret = C_RTMP_SendPacket(r, pkt, 0)
|
||||||
// TODO: Port this
|
// TODO: Port this
|
||||||
//C.RTMPPacket_Free(pkt)
|
|
||||||
C_RTMPPacket_Free(pkt)
|
C_RTMPPacket_Free(pkt)
|
||||||
pkt.m_nBytesRead = 0
|
pkt.m_nBytesRead = 0
|
||||||
if ret == 0 {
|
if ret == 0 {
|
||||||
|
@ -2197,13 +2101,6 @@ func C_RTMP_Write(r *C_RTMP, buf []byte) int {
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func realloc(ptr unsafe.Pointer, newSize uint32) unsafe.Pointer {
|
|
||||||
return unsafe.Pointer(crt.Xrealloc(crt.TLS(uintptr(unsafe.Pointer(nil))),
|
|
||||||
uintptr(ptr), uint32(newSize)))
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func memmove(to, from unsafe.Pointer, n uintptr) {
|
func memmove(to, from unsafe.Pointer, n uintptr) {
|
||||||
if to != nil && from != nil && n != 0 {
|
if to != nil && from != nil && n != 0 {
|
||||||
copy((*[_Gi]byte)(to)[:n], (*[_Gi]byte)(from)[:n])
|
copy((*[_Gi]byte)(to)[:n], (*[_Gi]byte)(from)[:n])
|
||||||
|
|
Loading…
Reference in New Issue