Use sampling only for closed pipe errors (#928)
This commit is contained in:
@@ -153,8 +153,8 @@ type DownTrack struct {
|
|||||||
deltaStatsSnapshotId uint32
|
deltaStatsSnapshotId uint32
|
||||||
|
|
||||||
// Debug info
|
// Debug info
|
||||||
pktsDropped atomic.Uint32
|
pktsDropped atomic.Uint32
|
||||||
writeErrors atomic.Uint32
|
writeIOErrors atomic.Uint32
|
||||||
|
|
||||||
isNACKThrottled atomic.Bool
|
isNACKThrottled atomic.Bool
|
||||||
|
|
||||||
@@ -475,9 +475,13 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
|
|||||||
_, err = d.writeStream.WriteRTP(hdr, payload)
|
_, err = d.writeStream.WriteRTP(hdr, payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.pktsDropped.Inc()
|
d.pktsDropped.Inc()
|
||||||
writeErrors := d.writeErrors.Inc()
|
if errors.Is(err, io.ErrClosedPipe) {
|
||||||
if (writeErrors % 100) == 1 {
|
writeIOErrors := d.writeIOErrors.Inc()
|
||||||
d.logger.Errorw("write rtp packet failed", err, "count", writeErrors)
|
if (writeIOErrors % 100) == 1 {
|
||||||
|
d.logger.Errorw("write rtp packet failed", err, "count", writeIOErrors)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
d.logger.Errorw("write rtp packet failed", err)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user