diff --git a/revid/senders.go b/revid/senders.go index eb1dd371..ba54ac7c 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -209,7 +209,7 @@ func (s *ffmpegSender) close() error { // rtmpSender implements loadSender for a native RTMP destination. type rtmpSender struct { - sess rtmp.Session + sess *rtmp.Session url string timeout uint @@ -222,7 +222,7 @@ type rtmpSender struct { var _ restarter = (*rtmpSender)(nil) func newRtmpSender(url string, timeout uint, retries int, log func(lvl, msg string)) (*rtmpSender, error) { - var sess rtmp.Session + var sess *rtmp.Session var err error for n := 0; n < retries; n++ { sess = rtmp.NewSession(url, timeout) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index ceea4b62..11659f7f 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -259,14 +259,8 @@ var ( } ) -type Session interface { - Open() error - Write([]byte) (int, error) - Close() error -} - // session provides parameters required for an rtmp communication session. -type session struct { +type Session struct { rtmp *C_RTMP url string timeout uint @@ -440,8 +434,8 @@ type P_vu struct { } // NewSession returns a new session. -func NewSession(url string, connectTimeout uint) Session { - return &session{ +func NewSession(url string, connectTimeout uint) *Session { + return &Session{ url: url, timeout: connectTimeout, } @@ -449,7 +443,7 @@ func NewSession(url string, connectTimeout uint) Session { // Open establishes an rtmp connection with the url passed into the // constructor -func (s *session) Open() error { +func (s *Session) Open() error { if s.rtmp != nil { return errors.New("rtmp: attempt to start already running session") } @@ -462,7 +456,7 @@ func (s *session) Open() error { } // Close terminates the rtmp connection -func (s *session) Close() error { +func (s *Session) Close() error { if s.rtmp == nil { return Err(3) } @@ -475,7 +469,7 @@ func (s *session) Close() error { } // 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 { return 0, Err(3) }