Use the correct snapshot id for PPS. (#2528)

* Use the correct snapshot id for PPS.

That caused connection quality to operate on small windows.

* remove debug
This commit is contained in:
Raja Subramanian
2024-02-29 22:48:36 +05:30
committed by GitHub
parent ea66eae9f5
commit d40041d013
+3 -3
View File
@@ -103,7 +103,7 @@ type Buffer struct {
rtpStats *RTPStatsReceiver rtpStats *RTPStatsReceiver
rrSnapshotId uint32 rrSnapshotId uint32
deltaStatsSnapshotId uint32 deltaStatsSnapshotId uint32
ppsSnapshortId uint32 ppsSnapshotId uint32
lastFractionLostToReport uint8 // Last fraction lost from subscribers, should report to publisher; Audio only lastFractionLostToReport uint8 // Last fraction lost from subscribers, should report to publisher; Audio only
@@ -193,7 +193,7 @@ func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapabili
}) })
b.rrSnapshotId = b.rtpStats.NewSnapshotId() b.rrSnapshotId = b.rtpStats.NewSnapshotId()
b.deltaStatsSnapshotId = b.rtpStats.NewSnapshotId() b.deltaStatsSnapshotId = b.rtpStats.NewSnapshotId()
b.ppsSnapshortId = b.rtpStats.NewSnapshotId() b.ppsSnapshotId = b.rtpStats.NewSnapshotId()
b.clockRate = codec.ClockRate b.clockRate = codec.ClockRate
b.lastReport = time.Now() b.lastReport = time.Now()
@@ -790,7 +790,7 @@ func (b *Buffer) mayGrowBucket() {
return return
} }
oldCap := cap oldCap := cap
deltaInfo := b.rtpStats.DeltaInfo(b.deltaStatsSnapshotId) deltaInfo := b.rtpStats.DeltaInfo(b.ppsSnapshotId)
if deltaInfo != nil && deltaInfo.Duration > 500*time.Millisecond { if deltaInfo != nil && deltaInfo.Duration > 500*time.Millisecond {
pps := int(time.Duration(deltaInfo.Packets) * time.Second / deltaInfo.Duration) pps := int(time.Duration(deltaInfo.Packets) * time.Second / deltaInfo.Duration)
for pps > cap && cap < maxPkts { for pps > cap && cap < maxPkts {