Merge init into NewSession.

This commit is contained in:
scruzin 2019-01-09 22:05:04 +10:30
parent d1958ff75d
commit c8ec317823
1 changed files with 13 additions and 18 deletions

View File

@ -78,9 +78,19 @@ const (
// NewSession returns a new Session.
func NewSession(url string, timeout uint, log Log) *Session {
return &Session{
url: url,
timeout: timeout,
log: log,
url: url,
inChunkSize: 128,
outChunkSize: 128,
clientBW: 2500000,
clientBW2: 2,
serverBW: 2500000,
audioCodecs: 3191.0,
videoCodecs: 252.0,
log: log,
link: link{
timeout: timeout,
swfAge: 30,
},
}
}
@ -99,7 +109,6 @@ func (s *Session) Open() error {
// start does the heavylifting for Open().
func (s *Session) start() error {
s.log(DebugLevel, pkg+"Session.start")
s.init()
err := setupURL(s, s.url)
if err != nil {
s.close()
@ -121,20 +130,6 @@ func (s *Session) start() error {
return nil
}
// init initializes various RTMP defauls.
// ToDo: define consts for the magic numbers.
func (s *Session) init() {
s.inChunkSize = RTMP_DEFAULT_CHUNKSIZE
s.outChunkSize = RTMP_DEFAULT_CHUNKSIZE
s.clientBW = 2500000
s.clientBW2 = 2
s.serverBW = 2500000
s.audioCodecs = 3191.0
s.videoCodecs = 252.0
s.link.timeout = s.timeout
s.link.swfAge = 30
}
// Close terminates the rtmp connection,
func (s *Session) Close() error {
if !s.isConnected() {