Large number of 'layerschange' events with mediasoup 3.1.5

Hi,

I just upgraded mediasoup from 3.1.0 to 3.1.5 and am now seeing 10-20 ‘layerschange’ events per second that affect only the temporalLayer, for every consumer with simulcast streams. There’s a noticeable impact on video framerate (so I don’t think that this is just a cosmetic warning I can ignore).

Bisecting my changes indicates that downgrading to 3.1.4 makes these go away. So does sending only a single encoding.

mediasoup:worker[pid:21853] RTC::Transport::ReceiveRtcpPacket() | no Consumer found for received Receiver Report [ssrc:905464878] +273ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 2 } +233ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 0 } +36ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 1 } +1ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 0 } +66ms
  mediasoup:worker[pid:21853] RTC::Transport::ReceiveRtcpPacket() | no Consumer found for received Receiver Report [ssrc:905464878] +263ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 2 } +160ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 0 } +31ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 1 } +0ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 0 } +72ms
  mediasoup:worker[pid:21853] RTC::Transport::ReceiveRtcpPacket() | no Consumer found for received Receiver Report [ssrc:905464878] +282ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 2 } +177ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 0 } +30ms
  demo-app consumer layerschange d93-483-083b->d93-483-083b cam-video { spatialLayer: 1, temporalLayer: 1 } +1ms

I’m not filing an issue because I’m assuming this is showing up some bad code on my part. :slight_smile: But I can file an issue if that’s helpful.

To reproduce:

  1. https://github.com/daily-co/mediasoup-sandbox.git
  2. cd mediasoup-sandbox/single-page/
  3. npm install
  4. DEBUG=“mediasoup*, demo-app*” npm run start
  5. open http://localhost:3000/ in a web browser
  6. click on “send camera streams”
  7. click on the “subscribe” button next to “my cam-video”
  8. see the debug messages from the ‘layerschange’ event handler in the server terminal window

Reproduces for me on Chrome 75.0.3770.80/Linux, Chrome 75.0.3770.100/OS X, Safari 12.1.1/OS X, Chrome 75.0.3770.100/Windows, and Firefox 67.0.1/Windows.

Here are the mediaCodecs passed to worker.createRouter():

      mediaCodecs:
        [
          {
            kind: 'audio',
            mimeType: 'audio/opus',
            clockRate: 48000,
            channels: 2
          },
          {
            kind: 'video',
            mimeType: 'video/VP8',
            clockRate: 90000,
            parameters:
              {
//                'x-google-start-bitrate': 1000
              }
          }

And here are the simulcast encodings I’m passing to transport.produce() (all the encodings I’ve tried seem to have this same behavior, though):

[
  { maxBitrate:  96000, scaleResolutionDownBy: 4 },
  { maxBitrate: 680000, scaleResolutionDownBy: 1 },
]

Let’s some days to come to this, please. Super busy now.

Please, report it in GitHub. I see the very same problem in the official demo so something is wrong.

Also, please indicate that it happens in both VP8 and H264 simulcast, but it does not happen in VP9 SVC.

No need to report it, I see the bug. Will be fixed soon.

Reported.

Fixed in https://github.com/versatica/mediasoup/commit/ca3166026f420c3dbe3c0e3e39aa2a9f13abe726. Released in 3.1.6.

Many thanks.

1 Like