Stop logging each dropped packet
This commit is contained in:
@@ -30,7 +30,8 @@ type RTMPClient struct {
|
||||
|
||||
keyframeSent bool
|
||||
|
||||
bytesSent atomic.Uint64
|
||||
bytesSent atomic.Uint64
|
||||
droppedPackets atomic.Uint64
|
||||
|
||||
packetsChan chan av.Packet
|
||||
}
|
||||
@@ -159,7 +160,12 @@ func (s *Stream) handleBroadcaster(c *rtmp.Conn, nc net.Conn) {
|
||||
s.bytesSent.Add(uint64(len(pkt.Data)))
|
||||
continue
|
||||
default:
|
||||
logger.Info("Client channel is blocking.", zap.String("client_addr", client.nc.RemoteAddr().String()))
|
||||
dropped := client.droppedPackets.Inc()
|
||||
if dropped%1000 == 0 {
|
||||
logger.Info("Multiple packets to client have been dropped.",
|
||||
zap.String("client_addr", client.nc.RemoteAddr().String()),
|
||||
zap.Uint64("dropped_packets", dropped))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +183,8 @@ func (client *RTMPClient) handleClient() {
|
||||
"client_addr", client.nc.RemoteAddr().String(),
|
||||
"stream_name", stream.Name,
|
||||
"watch_duration", time.Since(client.timestamp),
|
||||
"bytes_sent", humanize.Bytes(client.bytesSent.Load()))
|
||||
"bytes_sent", humanize.Bytes(client.bytesSent.Load()),
|
||||
"dropped_packets", client.droppedPackets.Load())
|
||||
}()
|
||||
|
||||
server.Logger.Infow("Viewer connected.", "stream", stream.Name, "client_addr", client.nc.RemoteAddr().String())
|
||||
|
Reference in New Issue
Block a user