mirror of https://bitbucket.org/ausocean/av.git
Finally found value for av_connect
This commit is contained in:
parent
7088a88fe9
commit
46673e0309
33
rtmp/rtmp.go
33
rtmp/rtmp.go
|
@ -154,6 +154,7 @@ func memmove(to, from unsafe.Pointer, n uintptr) {
|
|||
|
||||
// av_setDataFrame is a static const global in rtmp.c
|
||||
var setDataFrame = AVC("@setDataFrame")
|
||||
var av_connect = AVC("connect")
|
||||
|
||||
var packetSize = [...]int{12, 8, 4, 1}
|
||||
|
||||
|
@ -694,7 +695,7 @@ func rtmpConnect1(r *C.RTMP, cp *C.RTMPPacket) int {
|
|||
log.Println("... connected, handshaking...")
|
||||
}
|
||||
// TODO: port this
|
||||
if C.HandShake(r, 1) == 0 {
|
||||
if handShake(r, 1) == 0 {
|
||||
log.Println("rtmpConnect1: handshake failed!")
|
||||
return 0
|
||||
}
|
||||
|
@ -703,7 +704,7 @@ func rtmpConnect1(r *C.RTMP, cp *C.RTMPPacket) int {
|
|||
}
|
||||
|
||||
// TODO: port this
|
||||
if C.SendConnectPacket(r, cp) == 0 {
|
||||
if sendConnectPacket(r, cp) == 0 {
|
||||
log.Println("RTMP connect failed!")
|
||||
return 0
|
||||
}
|
||||
|
@ -778,12 +779,38 @@ func handShake(r *C.RTMP, FP9HandShake int32) int {
|
|||
bMatch = 1
|
||||
}
|
||||
|
||||
if bMatch != 0 {
|
||||
if bMatch == 0 {
|
||||
log.Println("Client signature does not match!")
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||
var packet C.RTMPPacket
|
||||
var pbuf [4096]byte
|
||||
pend := incBytePtr(unsafe.Pointer(&pbuf[0]), int(unsafe.Sizeof(pbuf)))
|
||||
var enc *byte
|
||||
|
||||
if cp != nil {
|
||||
return sendPacket(r, cp, 1)
|
||||
}
|
||||
|
||||
packet.m_nChannel = 0x03
|
||||
packet.m_headerType = RTMP_PACKET_SIZE_LARGE
|
||||
packet.m_packetType = RTMP_PACKET_TYPE_INVOKE
|
||||
packet.m_nTimeStamp = 0
|
||||
packet.m_nInfoField2 = 0
|
||||
packet.m_hasAbsTimestamp = 0
|
||||
packet.m_body = (*C.char)(incBytePtr(unsafe.Pointer(&pbuf[0]),
|
||||
RTMP_MAX_HEADER_SIZE))
|
||||
|
||||
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
||||
enc = afmEncodeString(enc, (*byte)(pend), &av_connect)
|
||||
r.m_numInvokes += 1
|
||||
enc = afmEncodeString(unsafe.Pointer(enc), unsafe.Pointer(pend), r.m_numInvokes)
|
||||
return 1
|
||||
}
|
||||
|
||||
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
||||
var packet C.RTMPPacket
|
||||
|
||||
|
|
Loading…
Reference in New Issue