* Add ability to roll back video layer selection. Not currently useful, but it is possible to do things like not applying a layer switch if the switch point time stamp is too far back. Add ability to roll back a layer switch and invoke rollback if a packet was selected for forwarding, but a subsequent error or decision to drop the packet can rollback layer switch if that was the switching packet. In current code, the paths where a packet can be dropped after selection does not happen at switch points. So, it was okay to apply the selection unconditionally. But, adding the call to rollback in the current code also in all paths where packet is dropped after selection for consistent code flow. * separate switch for temporal layer
53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
package videolayerselector
|
|
|
|
import (
|
|
"github.com/livekit/livekit-server/pkg/sfu/buffer"
|
|
"github.com/livekit/livekit-server/pkg/sfu/videolayerselector/temporallayerselector"
|
|
)
|
|
|
|
type VideoLayerSelectorResult struct {
|
|
IsSelected bool
|
|
IsRelevant bool
|
|
IsSwitching bool
|
|
IsResuming bool
|
|
IsSwitchingToRequestSpatial bool
|
|
IsSwitchingToMaxSpatial bool
|
|
MaxSpatialLayer int32
|
|
RTPMarker bool
|
|
DependencyDescriptorExtension []byte
|
|
}
|
|
|
|
type VideoLayerSelector interface {
|
|
IsOvershootOkay() bool
|
|
|
|
SetTemporalLayerSelector(tls temporallayerselector.TemporalLayerSelector)
|
|
|
|
SetMax(maxLayer buffer.VideoLayer)
|
|
SetMaxSpatial(layer int32)
|
|
SetMaxTemporal(layer int32)
|
|
GetMax() buffer.VideoLayer
|
|
|
|
SetTarget(targetLayer buffer.VideoLayer)
|
|
GetTarget() buffer.VideoLayer
|
|
|
|
SetRequestSpatial(layer int32)
|
|
GetRequestSpatial() int32
|
|
|
|
CheckSync() (locked bool, layer int32)
|
|
|
|
SetMaxSeen(maxSeenLayer buffer.VideoLayer)
|
|
SetMaxSeenSpatial(layer int32)
|
|
SetMaxSeenTemporal(layer int32)
|
|
GetMaxSeen() buffer.VideoLayer
|
|
|
|
SetParked(parkedLayer buffer.VideoLayer)
|
|
GetParked() buffer.VideoLayer
|
|
|
|
SetCurrent(currentLayer buffer.VideoLayer)
|
|
GetCurrent() buffer.VideoLayer
|
|
|
|
Select(extPkt *buffer.ExtPacket, layer int32) VideoLayerSelectorResult
|
|
SelectTemporal(extPkt *buffer.ExtPacket) (int32, bool)
|
|
Rollback()
|
|
}
|