Spatial layer with low resolution can't select the preferredLAyer

Hi everyone, I’m generating producers with the following encodings:

[{
	scaleResolutionDownBy : 4,
	maxBitrate            : 150_000
}, {
	scaleResolutionDownBy : 2,
	maxBitrate            : 500_000
}, {
	scaleResolutionDownBy : 1,
	maxBitrate            : 1_200_000
}]

this work perfectly when the track start with 1280x720, high resolution, spatial layer selected is the highest (currentlyLayer: 2), if i change prereferredLayer the selected layer (currentlyLayer) also changes, and consumerScore always is:

{
  score: 10,
  producerScore: 10,
  producerScores: [ 10, 10, 10 ]
}

But if i change the resolution to low:

await track.applyConstraints(
	{
		...VIDEO_CONSTRAINS[resolution],
		frameRate
	}
);

the selected layer change to the lowest (currentlyLayer: 0), it means, use the encoding with scaleResolutionDownBy: 4 accesing through the event layerschange, i still maintain the preferredLayer to 2. And i can see that consumerScore change to:

{
  score: 10,
  producerScore: 10,
  producerScores: [ 10, 0, 0 ]
}

I am doing the tests with two participants.

Why does this happen? Shouldn’t I keep the spatial layer higher if conditions are optimal? Is there something I could be doing incorrectly?

You are applying a resolution to the video track that makes your browser stop encoding higher simulcast streams. That’s how things work. This is not mediasoup-client business but browser’s one.

Thanks @ibc .

And is there a way to modify the encodings of the producer at the same time that the resolution is modified without having to recreate the producer?