Code refactoring for debug packet logger

This commit is contained in:
Alex X
2024-05-26 00:19:26 +03:00
parent 0ccfcb0ec0
commit 8e571a66e3

View File

@@ -24,7 +24,7 @@ func Logger(include func(packet *rtp.Packet) bool) func(packet *rtp.Packet) {
now := time.Now()
fmt.Printf(
"%s: size:%6d, ts:%10d, type:%2d, ssrc:%d, seq:%5d, mark:%t, dts:%4d, dtime:%3d\n",
"%s: size=%6d ts=%10d type=%2d ssrc=%d seq=%5d mark=%t dts=%4d dtime=%3dms\n",
now.Format("15:04:05.000"),
len(packet.Payload), packet.Timestamp, packet.PayloadType, packet.SSRC, packet.SequenceNumber, packet.Marker,
packet.Timestamp-lastTS, now.Sub(lastTime).Milliseconds(),
@@ -41,7 +41,7 @@ func Logger(include func(packet *rtp.Packet) bool) func(packet *rtp.Packet) {
if dt := now.Sub(secTime); dt > time.Second {
fmt.Printf(
"%s: size:%6d, cnt:%d, dts: %d, dtime:%d\n",
"%s: size=%6d cnt=%d dts=%d dtime=%3dms\n",
now.Format("15:04:05.000"),
secSize, secCnt, lastTS-secTS, dt.Milliseconds(),
)