Exempt layers in stream tracker
For now, exempt layer 0 from stream tracker declaring it stopped.
@@ -9,6 +9,10 @@ import (
"github.com/livekit/protocol/logger"
)
+var (
+ exemptLayers = []int32{0}
+)
+
var (
ConfigVideo = []StreamTrackerParams{
{
@@ -93,7 +97,18 @@ func (s *StreamTrackerManager) AddTracker(layer int32) {
tracker := NewStreamTracker(params)
tracker.OnStatusChanged(func(status StreamStatus) {
if status == StreamStatusStopped {
+ exempt := false
+ for _, l := range exemptLayers {
+ if layer == l {
+ exempt = true
+ break
+ }
+ }
+ if !exempt {
s.removeAvailableLayer(layer)
+ } else {
+ s.logger.Debugw("not removing exempt layer", "layer", layer)
+ }
} else {
s.addAvailableLayer(layer)
}
