When SetMaxSpatialLayer() is called with target/current layers in InvalidLayerSpatial state, opportunistically initialize the target layer to avoid dropped packets during async stream allocator initialization. Guards: - Only sets target if not congestion-throttled (isDeficientLocked) - Does not set current layer (deferred to keyframe-based forwarder start) - Logs at Debug level to avoid log noise This prevents undefined layer state during manual subscription with immediate quality upgrades (WithAutoSubscribe(false) + SetVideoQuality(HIGH)).
This commit is contained in:
@@ -464,6 +464,9 @@ func TestForwarderProvisionalAllocate(t *testing.T) {
|
||||
f.SetMaxPublishedLayer(buffer.DefaultMaxLayerSpatial)
|
||||
f.SetMaxTemporalLayerSeen(buffer.DefaultMaxLayerTemporal)
|
||||
|
||||
// Reset to invalid layers for testing allocation from scratch
|
||||
disable(f)
|
||||
|
||||
bitrates := Bitrates{
|
||||
{1, 2, 3, 4},
|
||||
{5, 6, 7, 8},
|
||||
@@ -682,6 +685,9 @@ func TestForwarderProvisionalAllocateMute(t *testing.T) {
|
||||
f.SetMaxSpatialLayer(buffer.DefaultMaxLayerSpatial)
|
||||
f.SetMaxTemporalLayer(buffer.DefaultMaxLayerTemporal)
|
||||
|
||||
// Reset to invalid layers for testing muted state
|
||||
disable(f)
|
||||
|
||||
bitrates := Bitrates{
|
||||
{1, 2, 3, 4},
|
||||
{5, 6, 7, 8},
|
||||
@@ -723,6 +729,9 @@ func TestForwarderProvisionalAllocateGetCooperativeTransition(t *testing.T) {
|
||||
f.SetMaxPublishedLayer(buffer.DefaultMaxLayerSpatial)
|
||||
f.SetMaxTemporalLayerSeen(buffer.DefaultMaxLayerTemporal)
|
||||
|
||||
// Reset to invalid layers for testing cooperative transition from scratch
|
||||
disable(f)
|
||||
|
||||
availableLayers := []int32{0, 1, 2}
|
||||
bitrates := Bitrates{
|
||||
{1, 2, 3, 4},
|
||||
|
||||
Reference in New Issue
Block a user