rtmp: split connect from connectPlay
This commit is contained in:
parent
0b9155a9cf
commit
bde39ebc16
@ -578,20 +578,18 @@ func (self *Conn) probe() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Conn) connectPlay() (err error) {
|
func (self *Conn) connect(path string) (err error) {
|
||||||
connectpath, playpath := splitPath(self.Path)
|
|
||||||
|
|
||||||
// > connect("app")
|
// > connect("app")
|
||||||
if self.Debug {
|
if self.Debug {
|
||||||
fmt.Printf("rtmp: > connect('%s') host=%s\n", connectpath, self.Host)
|
fmt.Printf("rtmp: > connect('%s') host=%s\n", path, self.Host)
|
||||||
}
|
}
|
||||||
w := self.writeCommandMsgStart()
|
w := self.writeCommandMsgStart()
|
||||||
flvio.WriteAMF0Val(w, "connect")
|
flvio.WriteAMF0Val(w, "connect")
|
||||||
flvio.WriteAMF0Val(w, 1)
|
flvio.WriteAMF0Val(w, 1)
|
||||||
flvio.WriteAMF0Val(w, flvio.AMFMap{
|
flvio.WriteAMF0Val(w, flvio.AMFMap{
|
||||||
"app": connectpath,
|
"app": path,
|
||||||
"flashVer": "MAC 22,0,0,192",
|
"flashVer": "MAC 22,0,0,192",
|
||||||
"tcUrl": fmt.Sprintf("rtmp://%s/%s", self.Host, connectpath),
|
"tcUrl": fmt.Sprintf("rtmp://%s/%s", self.Host, path),
|
||||||
"fpad": false,
|
"fpad": false,
|
||||||
"capabilities": 15,
|
"capabilities": 15,
|
||||||
"audioCodecs": 4071,
|
"audioCodecs": 4071,
|
||||||
@ -629,11 +627,21 @@ func (self *Conn) connectPlay() (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *Conn) connectPlay() (err error) {
|
||||||
|
connectpath, playpath := splitPath(self.Path)
|
||||||
|
|
||||||
|
if err = self.connect(connectpath); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// > createStream()
|
// > createStream()
|
||||||
if self.Debug {
|
if self.Debug {
|
||||||
fmt.Printf("rtmp: > createStream()\n")
|
fmt.Printf("rtmp: > createStream()\n")
|
||||||
}
|
}
|
||||||
w = self.writeCommandMsgStart()
|
w := self.writeCommandMsgStart()
|
||||||
flvio.WriteAMF0Val(w, "createStream")
|
flvio.WriteAMF0Val(w, "createStream")
|
||||||
flvio.WriteAMF0Val(w, 2)
|
flvio.WriteAMF0Val(w, 2)
|
||||||
flvio.WriteAMF0Val(w, nil)
|
flvio.WriteAMF0Val(w, nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user