mirror of https://bitbucket.org/ausocean/av.git
Ported RTMP_IsConnected and tested
This commit is contained in:
parent
d00a2994e3
commit
6cc807f56f
13
rtmp/rtmp.go
13
rtmp/rtmp.go
|
@ -355,7 +355,7 @@ func (s *session) Write(data []byte) (int, error) {
|
||||||
return 0, Err(3)
|
return 0, Err(3)
|
||||||
}
|
}
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
if C.RTMP_IsConnected(s.rtmp) == 0 {
|
if rtmpIsConnected(s.rtmp) == 0 {
|
||||||
return 0, Err(1)
|
return 0, Err(1)
|
||||||
}
|
}
|
||||||
//if C.RTMP_Write(s.rtmp,(*C.char)(unsafe.Pointer(&data[0])),C.int(len(data))) == 0 {
|
//if C.RTMP_Write(s.rtmp,(*C.char)(unsafe.Pointer(&data[0])),C.int(len(data))) == 0 {
|
||||||
|
@ -365,6 +365,13 @@ func (s *session) Write(data []byte) (int, error) {
|
||||||
return len(data), nil
|
return len(data), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func rtmpIsConnected(r *C.RTMP) int {
|
||||||
|
if r.m_sb.sb_socket != -1 {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
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 = rtmpAlloc()
|
||||||
|
@ -489,7 +496,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 C.RTMP_IsConnected(r) != 0 {
|
if rtmpIsConnected(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 {
|
||||||
|
@ -691,7 +698,7 @@ func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
||||||
r.m_mediaChannel = 0
|
r.m_mediaChannel = 0
|
||||||
|
|
||||||
// TODO: port is connected and read packet
|
// TODO: port is connected and read packet
|
||||||
for r.m_bPlaying == 0 && C.RTMP_IsConnected(r) != 0 &&
|
for r.m_bPlaying == 0 && rtmpIsConnected(r) != 0 &&
|
||||||
C.RTMP_ReadPacket(r, &packet) != 0 {
|
C.RTMP_ReadPacket(r, &packet) != 0 {
|
||||||
|
|
||||||
// TODO: port is ready
|
// TODO: port is ready
|
||||||
|
|
Loading…
Reference in New Issue