mirror of https://bitbucket.org/ausocean/av.git
Simplifed connectStream().
This commit is contained in:
parent
f635be6712
commit
53bccaaaa7
17
rtmp/rtmp.go
17
rtmp/rtmp.go
|
@ -192,22 +192,19 @@ func connect(s *Session) error {
|
|||
// connectStream reads a packet and handles it
|
||||
func connectStream(s *Session) error {
|
||||
var err error
|
||||
for !s.isPlaying && s.isConnected() {
|
||||
for !s.isPlaying {
|
||||
pkt := packet{}
|
||||
err = pkt.read(s)
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
if pkt.bodySize == 0 {
|
||||
continue
|
||||
}
|
||||
if pkt.packetType == RTMP_PACKET_TYPE_AUDIO ||
|
||||
pkt.packetType == RTMP_PACKET_TYPE_VIDEO ||
|
||||
pkt.packetType == RTMP_PACKET_TYPE_INFO {
|
||||
s.log(DebugLevel, pkg+"got packet before play; ignoring")
|
||||
continue
|
||||
}
|
||||
|
||||
switch pkt.packetType {
|
||||
case RTMP_PACKET_TYPE_AUDIO, RTMP_PACKET_TYPE_VIDEO, RTMP_PACKET_TYPE_INFO:
|
||||
s.log(WarnLevel, pkg+"got packet before play; ignoring", "type", pkt.packetType)
|
||||
default:
|
||||
handlePacket(s, &pkt) // ignore errors
|
||||
}
|
||||
err = handlePacket(s, &pkt)
|
||||
if err != nil {
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue