mirror of https://bitbucket.org/ausocean/av.git
Merge init into NewSession.
This commit is contained in:
parent
d1958ff75d
commit
c8ec317823
|
@ -78,9 +78,19 @@ const (
|
||||||
// NewSession returns a new Session.
|
// NewSession returns a new Session.
|
||||||
func NewSession(url string, timeout uint, log Log) *Session {
|
func NewSession(url string, timeout uint, log Log) *Session {
|
||||||
return &Session{
|
return &Session{
|
||||||
url: url,
|
url: url,
|
||||||
timeout: timeout,
|
inChunkSize: 128,
|
||||||
log: log,
|
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().
|
// start does the heavylifting for Open().
|
||||||
func (s *Session) start() error {
|
func (s *Session) start() error {
|
||||||
s.log(DebugLevel, pkg+"Session.start")
|
s.log(DebugLevel, pkg+"Session.start")
|
||||||
s.init()
|
|
||||||
err := setupURL(s, s.url)
|
err := setupURL(s, s.url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.close()
|
s.close()
|
||||||
|
@ -121,20 +130,6 @@ func (s *Session) start() error {
|
||||||
return nil
|
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,
|
// Close terminates the rtmp connection,
|
||||||
func (s *Session) Close() error {
|
func (s *Session) Close() error {
|
||||||
if !s.isConnected() {
|
if !s.isConnected() {
|
||||||
|
|
Loading…
Reference in New Issue