43 lines
980 B
Go
43 lines
980 B
Go
package rtmp
|
|
|
|
import "fmt"
|
|
|
|
func NegotiateConnect(chnk_wrp_ptr *ChunkWrapper) (bool) {
|
|
if err := chnk_wrp_ptr.ReadPeerChunkSize(); err != nil {
|
|
return false
|
|
}
|
|
if err := chnk_wrp_ptr.ReadConnectCommand(); err != nil {
|
|
return false
|
|
}
|
|
if err := chnk_wrp_ptr.WriteWindowAckSize(); err != nil {
|
|
return false
|
|
}
|
|
if err := chnk_wrp_ptr.WritePeerBandwidth(); err != nil {
|
|
return false
|
|
}
|
|
if err := chnk_wrp_ptr.WriteChunkSize(); err != nil {
|
|
return false
|
|
}
|
|
if err := chnk_wrp_ptr.WriteConnectResponse(); err != nil {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
func CreateStream(chnk_wrp_ptr *ChunkWrapper) (bool) {
|
|
if _, err := chnk_wrp_ptr.ReadChunk(); err != nil {
|
|
return false
|
|
}
|
|
if _, err := chnk_wrp_ptr.ReadChunk(); err != nil {
|
|
return false
|
|
}
|
|
if err := chnk_wrp_ptr.ReadCreateStream(); err != nil {
|
|
return false
|
|
}
|
|
fmt.Println("test read")
|
|
if err := chnk_wrp_ptr.WriteCreateStreamResponse(); err != nil {
|
|
return false
|
|
}
|
|
fmt.Println("test")
|
|
return true
|
|
}
|