Changed name of rtmpAlloc to C_RTMP_Alloc

This commit is contained in:
saxon 2018-08-06 15:42:16 +09:30
parent fe16404448
commit ba101285ff
1 changed files with 5 additions and 6 deletions

View File

@ -393,7 +393,7 @@ func (s *session) Write(data []byte) (int, error) {
return 0, Err(3) return 0, Err(3)
} }
// if rtmpIsConnected(s.rtmp) == 0 { // if C_RTMP_IsConnected(s.rtmp) == 0 {
if C.RTMP_IsConnected(s.rtmp) == 0 { if C.RTMP_IsConnected(s.rtmp) == 0 {
return 0, Err(1) return 0, Err(1)
} }
@ -414,7 +414,7 @@ func C_RTMP_IsConnected(r *C.RTMP) int32 {
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 := C.int(timeout) connect_timeout := C.int(timeout)
rtmp = rtmpAlloc() rtmp = C_RTMP_Alloc()
//rtmp = C.RTMP_Alloc() //rtmp = C.RTMP_Alloc()
rtmpInit(rtmp) rtmpInit(rtmp)
//C.RTMP_Init(rtmp) //C.RTMP_Init(rtmp)
@ -447,8 +447,7 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
return rtmp, nil return rtmp, nil
} }
func C_RTMP_Alloc() *C.RTMP {
func rtmpAlloc() *C.RTMP {
var r C.RTMP var r C.RTMP
//return (*C.RTMP)(C.malloc(C.size_t(unsafe.Sizeof(r)))) //return (*C.RTMP)(C.malloc(C.size_t(unsafe.Sizeof(r))))
return (*C.RTMP)(allocate(unsafe.Sizeof(r))) return (*C.RTMP)(allocate(unsafe.Sizeof(r)))
@ -571,7 +570,7 @@ func rtmpClose(r *C.RTMP) {
func closeInternal(r *C.RTMP, reconnect int32) { func closeInternal(r *C.RTMP, reconnect int32) {
var i int32 var i int32
if rtmpIsConnected(r) != 0 { if C_RTMP_IsConnected(r) != 0 {
if r.m_stream_id > 0 { if r.m_stream_id > 0 {
i = int32(r.m_stream_id) i = int32(r.m_stream_id)
if r.Link.protocol&RTMP_FEATURE_WRITE != 0 { if r.Link.protocol&RTMP_FEATURE_WRITE != 0 {
@ -1264,7 +1263,7 @@ func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
r.m_mediaChannel = 0 r.m_mediaChannel = 0
// TODO: read packet // TODO: read packet
for r.m_bPlaying == 0 && rtmpIsConnected(r) != 0 && for r.m_bPlaying == 0 && C_RTMP_IsConnected(r) != 0 &&
C.RTMP_ReadPacket(r, &packet) != 0 { C.RTMP_ReadPacket(r, &packet) != 0 {
// TODO: port is ready // TODO: port is ready