mirror of https://bitbucket.org/ausocean/av.git
Wrote rtmp init func
This commit is contained in:
parent
8dc2b27bad
commit
e04ae76dcf
16
rtmp/rtmp.go
16
rtmp/rtmp.go
|
@ -322,7 +322,7 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
|
|||
url := C.CString(u)
|
||||
connect_timeout := C.int(timeout)
|
||||
rtmp = rtmpAlloc()
|
||||
C.RTMP_Init(rtmp)
|
||||
rtmpInit(rtmp)
|
||||
rtmp.Link.timeout = connect_timeout
|
||||
if C.RTMP_SetupURL(rtmp, url) == 0 {
|
||||
C.RTMP_Close(rtmp)
|
||||
|
@ -352,6 +352,20 @@ func rtmpAlloc() *C.RTMP {
|
|||
return (*C.RTMP)(allocate(unsafe.Sizeof(r)))
|
||||
}
|
||||
|
||||
func rtmpInit(r *C.RTMP) {
|
||||
r.m_sb.sb_socket = -1
|
||||
r.m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE
|
||||
r.m_outChunkSize = RTMP_DEFAULT_CHUNKSIZE
|
||||
r.m_nBufferMS = 30000
|
||||
r.m_nClientBW = 2500000
|
||||
r.m_nClientBW2 = 2
|
||||
r.m_nServerBW = 2500000
|
||||
r.m_fAudioCodecs = 3191.0
|
||||
r.m_fVideoCodecs = 252.0
|
||||
r.Link.timeout = 30
|
||||
r.Link.swfAge = 30
|
||||
}
|
||||
|
||||
// Close terminates the rtmp connection
|
||||
func (s *session) Close() error {
|
||||
if s.rtmp == nil {
|
||||
|
|
Loading…
Reference in New Issue