Simplifying (hopefully) sfu.DownTrack (#213)

* Simplifying (hopefully) sfu.DownTrack

* Remove unnecessary check as pdding only packets are dropped before that check

* Temporal filtering max layer

* - Split out forwarder bits into a separate structure
- Address comments from Jie and David

* Remove debug and unneeded stuff

* Fix test

* Remove unneeded default initialization
This commit is contained in:
Raja Subramanian
2021-11-28 09:15:36 +05:30
committed by GitHub
parent 092789a08f
commit e996c185ce
5 changed files with 845 additions and 834 deletions
+1 -2
View File
@@ -707,8 +707,7 @@ func (p *ParticipantImpl) GetConnectionQuality() livekit.ConnectionQuality {
if subTrack.IsMuted() {
continue
}
// LK-TODO: maybe this should check CurrentSpatialLayer as target may not have been achieved
if subTrack.DownTrack().TargetSpatialLayer() < subTrack.DownTrack().MaxSpatialLayer() {
if subTrack.DownTrack().GetForwardingStatus() != sfu.ForwardingStatusOptimal {
reducedQualitySub = true
}
subLoss += subTrack.SubscribeLossPercentage()
+1 -8
View File
@@ -45,17 +45,14 @@ func (a *atomicBool) get() bool {
+-+-+-+-+-+-+-+-+
*/
type VP8 struct {
TemporalSupported bool // LK-TODO: CLEANUP-REMOVE
FirstByte byte
FirstByte byte
PictureIDPresent int
PictureID uint16 /* 8 or 16 bits, picture ID */
PicIDIdx int // LK-TODO: CLEANUP-REMOVE
MBit bool
TL0PICIDXPresent int
TL0PICIDX uint8 /* 8 bits temporal level zero index */
TlzIdx int // LK-TODO: CLEANUP-REMOVE
// Optional Header If either of the T or K bits are set to 1,
// the TID/Y/KEYIDX extension field MUST be present.
@@ -100,15 +97,12 @@ func (p *VP8) Unmarshal(payload []byte) error {
if L && !T {
return errInvalidPacket
}
// Check if T is present, if not, no temporal layer is available
p.TemporalSupported = payload[idx]&0x20 > 0
// Check for PictureID
if I {
idx++
if payloadLen < idx+1 {
return errShortPacket
}
p.PicIDIdx = idx
p.PictureIDPresent = 1
pid := payload[idx] & 0x7f
// Check if m is 1, then Picture ID is 15 bits
@@ -129,7 +123,6 @@ func (p *VP8) Unmarshal(payload []byte) error {
if payloadLen < idx+1 {
return errShortPacket
}
p.TlzIdx = idx
p.TL0PICIDXPresent = 1
if int(idx) >= payloadLen {
+1 -1
View File
@@ -75,7 +75,7 @@ func TestVP8Helper_Unmarshal(t *testing.T) {
t.Errorf("Unmarshal() error = %v, wantErr %v", err, tt.wantErr)
}
if tt.checkTemporal {
assert.Equal(t, tt.temporalSupport, p.TemporalSupported)
assert.Equal(t, tt.temporalSupport, p.TIDPresent == 1)
}
if tt.checkKeyFrame {
assert.Equal(t, tt.keyFrame, p.IsKeyFrame)
+838 -821
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -1225,11 +1225,13 @@ type Track struct {
}
func newTrack(downTrack *DownTrack, peerID string) *Track {
maxSpatialLayer, maxTemporalLayer := downTrack.MaxLayers()
return &Track{
downTrack: downTrack,
peerID: peerID,
maxSpatialLayer: downTrack.MaxSpatialLayer(),
maxTemporalLayer: downTrack.MaxTemporalLayer(),
maxSpatialLayer: maxSpatialLayer,
maxTemporalLayer: maxTemporalLayer,
}
}