mirror of https://bitbucket.org/ausocean/av.git
Changed name of readN to C_ReadN
This commit is contained in:
parent
a04647fb3b
commit
c8407ac2d0
20
rtmp/rtmp.go
20
rtmp/rtmp.go
|
@ -784,7 +784,7 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
//if C.ReadN(r, (*C.char)(unsafe.Pointer(&typ)), 1) != 1 {
|
//if C.ReadN(r, (*C.char)(unsafe.Pointer(&typ)), 1) != 1 {
|
||||||
if readN(r, (*byte)(unsafe.Pointer(&typ)), 1) != 1 {
|
if C_ReadN(r, (*byte)(unsafe.Pointer(&typ)), 1) != 1 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -795,7 +795,7 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
||||||
log.Println("C_HandShake: type mismatch: client sent %v, server sent: %v",
|
log.Println("C_HandShake: type mismatch: client sent %v, server sent: %v",
|
||||||
clientbuf[0], typ)
|
clientbuf[0], typ)
|
||||||
}
|
}
|
||||||
if readN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
if C_ReadN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
||||||
//if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
//if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -809,7 +809,7 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if readN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
if C_ReadN(r, (*byte)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
||||||
//if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
//if C.ReadN(r, (*C.char)(unsafe.Pointer(&serversig[0])), RTMP_SIG_SIZE) != RTMP_SIG_SIZE {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func readN(r *C.RTMP, buffer *byte, n int) int {
|
func C_ReadN(r *C.RTMP, buffer *byte, n int) int {
|
||||||
nOriginalSize := n
|
nOriginalSize := n
|
||||||
var avail int
|
var avail int
|
||||||
var ptr *byte
|
var ptr *byte
|
||||||
|
@ -1298,7 +1298,7 @@ func rtmpReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
|
||||||
var didAlloc int32 = 0
|
var didAlloc int32 = 0
|
||||||
var extendedTimestamp int32
|
var extendedTimestamp int32
|
||||||
|
|
||||||
if readN(r, (*byte)(&hbuf[0]), 1) == 0 {
|
if C_ReadN(r, (*byte)(&hbuf[0]), 1) == 0 {
|
||||||
log.Println("rtmpReadPacket: failed to read RTMP packet header!")
|
log.Println("rtmpReadPacket: failed to read RTMP packet header!")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1309,7 +1309,7 @@ func rtmpReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case packet.m_nChannel == 0:
|
case packet.m_nChannel == 0:
|
||||||
if readN(r, (*byte)(&hbuf[1]), 1) != 1 {
|
if C_ReadN(r, (*byte)(&hbuf[1]), 1) != 1 {
|
||||||
log.Println("rtmpReadPacket: failed to read rtmp packet header 2nd byte.")
|
log.Println("rtmpReadPacket: failed to read rtmp packet header 2nd byte.")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1320,7 +1320,7 @@ func rtmpReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
|
||||||
case packet.m_nChannel == 1:
|
case packet.m_nChannel == 1:
|
||||||
var tmp int32
|
var tmp int32
|
||||||
|
|
||||||
if readN(r, (*byte)(&hbuf[1]), 2) != 2 {
|
if C_ReadN(r, (*byte)(&hbuf[1]), 2) != 2 {
|
||||||
log.Println("rtmpReadPacket: failed to read RTMP packet 3rd byte")
|
log.Println("rtmpReadPacket: failed to read RTMP packet 3rd byte")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1381,7 @@ func rtmpReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
|
||||||
|
|
||||||
nSize--
|
nSize--
|
||||||
|
|
||||||
if nSize > 0 && readN(r, header, int(nSize)) != int(nSize) {
|
if nSize > 0 && C_ReadN(r, header, int(nSize)) != int(nSize) {
|
||||||
log.Println("rtmpReadPacket: failed to read rtmp packet header.")
|
log.Println("rtmpReadPacket: failed to read rtmp packet header.")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1414,7 +1414,7 @@ func rtmpReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
if extendedTimestamp != 0 {
|
if extendedTimestamp != 0 {
|
||||||
if readN(r, (*byte)(incBytePtr(unsafe.Pointer(header), int(nSize))), 4) != 4 {
|
if C_ReadN(r, (*byte)(incBytePtr(unsafe.Pointer(header), int(nSize))), 4) != 4 {
|
||||||
log.Println("RTMPRead_Packet: Failed to read extended timestamp")
|
log.Println("RTMPRead_Packet: Failed to read extended timestamp")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1450,7 +1450,7 @@ func rtmpReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 {
|
||||||
packet.m_chunk.c_chunkSize = C.int(nChunk)
|
packet.m_chunk.c_chunkSize = C.int(nChunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
if readN(r, (*byte)(incBytePtr(unsafe.Pointer(packet.m_body), int(packet.m_nBytesRead))),
|
if C_ReadN(r, (*byte)(incBytePtr(unsafe.Pointer(packet.m_body), int(packet.m_nBytesRead))),
|
||||||
int(nChunk)) != int(nChunk) {
|
int(nChunk)) != int(nChunk) {
|
||||||
log.Println("rtmpReadPacket: failed to read RTMP packet body")
|
log.Println("rtmpReadPacket: failed to read RTMP packet body")
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
Loading…
Reference in New Issue