mirror of https://github.com/EasyDarwin/EasyDarwin
commit
7db2df2bc2
8
main.go
8
main.go
|
@ -136,6 +136,9 @@ func (p *program) Start(s service.Service) (err error) {
|
|||
}
|
||||
for i := len(streams) - 1; i > -1; i-- {
|
||||
v := streams[i]
|
||||
if rtsp.GetServer().GetPusher(v.CustomPath) != nil {
|
||||
continue
|
||||
}
|
||||
agent := fmt.Sprintf("EasyDarwinGo/%s", routers.BuildVersion)
|
||||
if routers.BuildDateTime != "" {
|
||||
agent = fmt.Sprintf("%s(%s)", agent, routers.BuildDateTime)
|
||||
|
@ -146,15 +149,12 @@ func (p *program) Start(s service.Service) (err error) {
|
|||
}
|
||||
client.CustomPath = v.CustomPath
|
||||
|
||||
pusher := rtsp.NewClientPusher(client)
|
||||
if rtsp.GetServer().GetPusher(pusher.Path()) != nil {
|
||||
continue
|
||||
}
|
||||
err = client.Start(time.Duration(v.IdleTimeout) * time.Second)
|
||||
if err != nil {
|
||||
log.Printf("Pull stream err :%v", err)
|
||||
continue
|
||||
}
|
||||
pusher := rtsp.NewClientPusher(client)
|
||||
rtsp.GetServer().AddPusher(pusher)
|
||||
//streams = streams[0:i]
|
||||
//streams = append(streams[:i], streams[i+1:]...)
|
||||
|
|
|
@ -354,12 +354,8 @@ func (pusher *Pusher) RemovePlayer(player *Player) *Pusher {
|
|||
|
||||
func (pusher *Pusher) ClearPlayer() {
|
||||
// copy a new map to avoid deadlock
|
||||
players := make(map[string]*Player)
|
||||
pusher.playersLock.Lock()
|
||||
for k, v := range pusher.players {
|
||||
//v.Stop()
|
||||
players[k] = v
|
||||
}
|
||||
players := pusher.players
|
||||
pusher.players = make(map[string]*Player)
|
||||
pusher.playersLock.Unlock()
|
||||
go func() { // do not block
|
||||
|
|
|
@ -418,17 +418,13 @@ func (client *RTSPClient) startStream() {
|
|||
client.logger.Printf("unknow rtp pack type, channel:%v", channel)
|
||||
continue
|
||||
}
|
||||
if pack == nil {
|
||||
client.logger.Printf("session tcp got nil rtp pack")
|
||||
continue
|
||||
}
|
||||
|
||||
if client.debugLogEnable {
|
||||
rtp := ParseRTP(pack.Buffer.Bytes())
|
||||
if rtp != nil {
|
||||
rtpSN := uint16(rtp.SequenceNumber)
|
||||
if client.lastRtpSN != 0 && client.lastRtpSN + 1 != rtpSN {
|
||||
client.logger.Printf("%s, %d packets lost, current SN=%d, last SN=%d\n", client.String(), rtpSN - client.lastRtpSN, rtpSN, client.lastRtpSN)
|
||||
if client.lastRtpSN != 0 && client.lastRtpSN+1 != rtpSN {
|
||||
client.logger.Printf("%s, %d packets lost, current SN=%d, last SN=%d\n", client.String(), rtpSN-client.lastRtpSN, rtpSN, client.lastRtpSN)
|
||||
}
|
||||
client.lastRtpSN = rtpSN
|
||||
}
|
||||
|
|
|
@ -249,11 +249,7 @@ func (session *Session) Start() {
|
|||
Buffer: rtpBuf,
|
||||
}
|
||||
default:
|
||||
logger.Printf("unknow rtp pack type, %v", pack.Type)
|
||||
continue
|
||||
}
|
||||
if pack == nil {
|
||||
logger.Printf("session tcp got nil rtp pack")
|
||||
logger.Printf("unknow rtp pack type, %v", channel)
|
||||
continue
|
||||
}
|
||||
session.InBytes += rtpLen + 4
|
||||
|
|
Loading…
Reference in New Issue