Got rid of writeFrame func we don't need

This commit is contained in:
saxon 2018-07-12 02:36:33 +09:30
parent 18cdcde149
commit d82838dcc0
1 changed files with 5 additions and 14 deletions

View File

@ -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
}