Removed session interface and mad session struct exported

This commit is contained in:
saxon 2018-08-20 10:22:36 +09:30
parent 9f61f33deb
commit 1b4db5b0dc
2 changed files with 8 additions and 14 deletions

View File

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

View File

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