mediasoup icon indicating copy to clipboard operation
mediasoup copied to clipboard

fix increase layer when current layer has not receive SR

Open penguinol opened this issue 1 year ago • 0 comments

For transport without bandwidth estimation, such as PlainRtpTransport, we will only change layers when receiving first SR of each stream or there is a change in the score. But in follow situation, we can not switch to the preferred layer. We may receive SR of preferred layer before we receiving keyframe of current target layer, when currentSpitalLayer is still -1. After we received keyframe of target layer, we received another SR of preferred layer, but it's not the first SR of this stream, so we will not call MayChangeLayers

sequenceDiagram
Src ->> mediasoup: CreateProducer S3T3
Dst->> mediasoup: CreateConsumer, perferred(2, 2)
Src ->> mediasoup: non-keyframe of S1
mediasoup->>mediasoup: targetSpatialLayer = 1, tsReferenceSpitalLayer = 1, s1 score = 10
Src ->> mediasoup: non-keyframe of S2
mediasoup->>mediasoup: s2 score = 10
Src ->> mediasoup: SenderReport of S1
mediasoup->>mediasoup: save ntp of S1
Src ->> mediasoup: SenderReport of S2
mediasoup->>mediasoup: fisrt SR of S2, but currentSpitalLayer is -1, does not call `MayChangeLayers` 
Src ->> mediasoup: key-frame of S1
mediasoup->>mediasoup: currentSpatialLayer = 1
Src ->> mediasoup: SenderReport of S2 
mediasoup->>mediasoup: not first SR of S2, does not call `MayChangeLayers`

penguinol avatar Jun 01 '23 02:06 penguinol