diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index eedb2fa5..aa5380b1 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -352,7 +352,7 @@ func (s *session) Close() error { if s.rtmp == nil { return Err(3) } - ret := C.end_session(s.rtmp) + ret := endSession(s.rtmp) s.rtmp = nil if ret != 0 { return Err(ret) @@ -360,6 +360,16 @@ func (s *session) Close() error { 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 func (s *session) Write(data []byte) (int, error) { if s.rtmp == nil {