Server-driven connection quality detection (#167)

This commit is contained in:
David Zhao
2021-11-03 21:05:20 -07:00
committed by GitHub
parent 862a212b93
commit aa9534b7fb
14 changed files with 818 additions and 81 deletions

View File

@@ -53,7 +53,6 @@ func initPacketStats() {
}
type PacketStats struct {
roomName string
direction string // incoming or outgoing
PacketBytes uint64 `json:"packetBytes"`
@@ -63,9 +62,8 @@ type PacketStats struct {
FIRTotal uint64 `json:"firTotal"`
}
func newPacketStats(room, direction string) *PacketStats {
func newPacketStats(direction string) *PacketStats {
return &PacketStats{
roomName: room,
direction: direction,
}
}
@@ -121,7 +119,6 @@ func (s *PacketStats) HandleRTCP(pkts []rtcp.Packet) {
func (s PacketStats) Copy() *PacketStats {
return &PacketStats{
roomName: s.roomName,
direction: s.direction,
PacketBytes: atomic.LoadUint64(&s.PacketBytes),
PacketTotal: atomic.LoadUint64(&s.PacketTotal),

View File

@@ -60,11 +60,10 @@ type RoomStatsReporter struct {
Outgoing *PacketStats
}
func NewRoomStatsReporter(roomName string) *RoomStatsReporter {
func NewRoomStatsReporter() *RoomStatsReporter {
return &RoomStatsReporter{
roomName: roomName,
Incoming: newPacketStats(roomName, "incoming"),
Outgoing: newPacketStats(roomName, "outgoing"),
Incoming: newPacketStats("incoming"),
Outgoing: newPacketStats("outgoing"),
}
}