implemented endSession func

This commit is contained in:
saxon 2018-07-19 16:07:31 +09:30
parent 6e8ef99953
commit cc616b12d4
1 changed files with 11 additions and 1 deletions

View File

@ -352,7 +352,7 @@ func (s *session) Close() error {
if s.rtmp == nil { if s.rtmp == nil {
return Err(3) return Err(3)
} }
ret := C.end_session(s.rtmp) ret := endSession(s.rtmp)
s.rtmp = nil s.rtmp = nil
if ret != 0 { if ret != 0 {
return Err(ret) return Err(ret)
@ -360,6 +360,16 @@ func (s *session) Close() error {
return nil return nil
} }
func endSession(rtmp *C.RTMP) uint32 {
if rtmp == nil {
return 3
}
C.RTMP_Close(rtmp)
C.RTMP_Free(rtmp)
return 0
}
// Write writes a frame (flv tag) to the rtmp connection // Write writes a frame (flv tag) to the rtmp connection
func (s *session) Write(data []byte) (int, error) { func (s *session) Write(data []byte) (int, error) {
if s.rtmp == nil { if s.rtmp == nil {