diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index f4fe36e2..bae982b5 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -205,25 +205,16 @@ func (s *session) rtmpWrite(r *C.RTMP, buf []byte) int { return size + s2 } -func (s *session) writeFrame(data []byte) uint { - if C.RTMP_IsConnected(s.rtmp) <= 0 { - return 1 - } - // This is where C.RTMP_Write would be used - if s.rtmpWrite(s.rtmp, data) <= 0 { - return 2 - } - return 0 -} - // Write writes a frame (flv tag) to the rtmp connection func (s *session) Write(data []byte) (int, error) { if s.rtmp == nil { return 0, Err(3) } - ret := s.writeFrame(data) - if ret != 0 { - return 0, Err(ret) + if C.RTMP_IsConnected(s.rtmp) <= 0 { + return 0, Err(1) + } + if s.rtmpWrite(s.rtmp, data) <= 0 { + return 0, Err(2) } return len(data), nil }