File: sent_stats.go

package info (click to toggle)
golang-github-pion-interceptor 0.1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 764 kB
  • sloc: makefile: 8
file content (64 lines) | stat: -rw-r--r-- 1,988 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package stats

import (
	"fmt"
	"time"
)

// SentRTPStreamStats contains common sender stats of RTP streams
type SentRTPStreamStats struct {
	PacketsSent uint64
	BytesSent   uint64
}

// String returns a string representation of SentRTPStreamStats
func (s SentRTPStreamStats) String() string {
	out := fmt.Sprintf("\tPacketsSent: %v\n", s.PacketsSent)
	out += fmt.Sprintf("\tBytesSent: %v\n", s.BytesSent)
	return out
}

// OutboundRTPStreamStats contains stats of outbound RTP streams
type OutboundRTPStreamStats struct {
	SentRTPStreamStats

	HeaderBytesSent uint64
	NACKCount       uint32
	FIRCount        uint32
	PLICount        uint32
}

// String returns a string representation of OutboundRTPStreamStats
func (s OutboundRTPStreamStats) String() string {
	out := "OutboundRTPStreamStats\n"
	out += s.SentRTPStreamStats.String()
	out += fmt.Sprintf("\tHeaderBytesSent: %v\n", s.HeaderBytesSent)
	out += fmt.Sprintf("\tNACKCount: %v\n", s.NACKCount)
	out += fmt.Sprintf("\tFIRCount: %v\n", s.FIRCount)
	out += fmt.Sprintf("\tPLICount: %v\n", s.PLICount)
	return out
}

// RemoteOutboundRTPStreamStats contains stats of outbound RTP streams of the
// remote peer
type RemoteOutboundRTPStreamStats struct {
	SentRTPStreamStats

	RemoteTimeStamp           time.Time
	ReportsSent               uint64
	RoundTripTime             time.Duration
	TotalRoundTripTime        time.Duration
	RoundTripTimeMeasurements uint64
}

// String returns a string representation of RemoteOutboundRTPStreamStats
func (s RemoteOutboundRTPStreamStats) String() string {
	out := "RemoteOutboundRTPStreamStats:\n"
	out += s.SentRTPStreamStats.String()
	out += fmt.Sprintf("\tRemoteTimeStamp: %v\n", s.RemoteTimeStamp)
	out += fmt.Sprintf("\tReportsSent: %v\n", s.ReportsSent)
	out += fmt.Sprintf("\tRoundTripTime: %v\n", s.RoundTripTime)
	out += fmt.Sprintf("\tTotalRoundTripTime: %v\n", s.TotalRoundTripTime)
	out += fmt.Sprintf("\tRoundTripTimeMeasurements: %v\n", s.RoundTripTimeMeasurements)
	return out
}