Misc/minor clean up. (#3183)

Cosmetic. While thinking through how to structure probing better,
noticing small things here and there. Cleaning up and making some small
PRs along the way.
This commit is contained in:
Raja Subramanian
2024-11-17 12:14:46 +05:30
committed by GitHub
parent aa2ce22655
commit cd718c84f6
11 changed files with 85 additions and 79 deletions
+3
View File
@@ -89,6 +89,9 @@ type BWE interface {
repeatedNacks uint32,
)
// TWCC sequence number
RecordPacketSendAndGetSequenceNumber(atMicro int64, size int, isRTX bool) uint16
HandleTWCCFeedback(report *rtcp.TransportLayerCC)
ProbingStart(expectedBandwidthUsage int64)
+7 -1
View File
@@ -14,7 +14,9 @@
package bwe
import "github.com/pion/rtcp"
import (
"github.com/pion/rtcp"
)
type NullBWE struct {
}
@@ -25,6 +27,10 @@ func (n *NullBWE) Reset() {}
func (n *NullBWE) Stop() {}
func (n *NullBWE) RecordPacketSendAndGetSequenceNumber(_atMicro int64, _size int, _isRTX bool) uint16 {
return 0
}
func (n *NullBWE) HandleREMB(
_receivedEstimate int64,
_isProbeFinalizing bool,
+3 -5
View File
@@ -17,7 +17,6 @@ package sendsidebwe
import (
"math/rand"
"sync"
"time"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils/mono"
@@ -51,18 +50,17 @@ func newPacketTracker(params packetTrackerParams) *packetTracker {
}
// SSBWE-TODO: this potentially needs to take isProbe as argument?
func (p *packetTracker) RecordPacketSendAndGetSequenceNumber(at time.Time, size int, isRTX bool) uint16 {
func (p *packetTracker) RecordPacketSendAndGetSequenceNumber(atMicro int64, size int, isRTX bool) uint16 {
p.lock.Lock()
defer p.lock.Unlock()
sendTime := at.UnixMicro()
if p.baseSendTime == 0 {
p.baseSendTime = sendTime
p.baseSendTime = atMicro
}
pi := p.getPacketInfo(uint16(p.sequenceNumber))
pi.sequenceNumber = p.sequenceNumber
pi.sendTime = sendTime - p.baseSendTime
pi.sendTime = atMicro - p.baseSendTime
pi.recvTime = 0
pi.size = uint16(size)
pi.isRTX = isRTX