Medisaoup continues to send data after WebRTC client is closed

Hello everyone,

we have recently started to use mediasoup for some of our programs and have finished last week one event where we streamed 6k webcams using mediasoup and everything worked nicely. So thanks to all who are working on this project, it really helped us to bring up our custom video conferecning system very quickly.

In the last few days we added a few more features to our implementation. Now we have implemented video broadcasting with mediasoup also, where we can send a video from one WebRTC client
to all other connected clients. We started our testing yesterday and made an interesting observation. As we are not the experts on the low level WebRTC procol we are wondering now if there is something we have overlooked or if this is a bug in mediasoup.

What we have tested is:

  • Our mediasoup worker is running with one router on our server. We are using mediasoup 3.6.24
  • We connect one client with WebRTC transport which will produce its camera and audio into media soup with 1Mpbs
  • Then we started WebRTC consumers (Chrome browser) and were able to see the camera and hear the audio of the producing WebRTC stream.
  • For the test we opened 10 chrome browsers and were able to see the video feed in all of them
  • On the server we see that outgoing datarate is 10Mbps which is as expected for 10 users at 1Mbps

Now after the test was done, and all WebRTC clients were closed, we saw that MedisSoup continues to send the video feed to the IP addresses of the previous connected clients. We observed this with nload network monitoring tool on the server which showed that mediasoup did not stop sending data.

It seems as if MediaSoup does not recognize that WebRTC transport had been closed and continues to send 10Mbits outgoing. After restarting the server the data transfert stopped.

Is there something that we are missing? Do we actively have to detect if WebRTC client has disconnected and then close the corresponding transport for it manully?

Or is this a bug in media soup?

As said we do not have the low level understanding of WebRTC but we thought that once WebRTC client is closed, mediasoup would automatically stop sending data to the endpoint.

It would be great if somone can shed some light on it and maybe give some hints about what we are missing.

Thanks you

Thomas

Is there something that we are missing? Do we actively have to detect if WebRTC client has disconnected and then close the corresponding transport for it manually?

You need to tell mediasoup, by the mechanism of your choice, to close the corresponding Transport/s when a client disconnects, and to close the corresponding Router when it’s not needed anymore, otherwise those will leak.

Everything is a bug in mediasoup.

Thank you for the quick response!