bluenviron / mediamtx

Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
MIT License
10.88k stars 1.41k forks source link

Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections, retrying in some seconds #3123

Open miquelmassot opened 4 months ago

miquelmassot commented 4 months ago

Which version are you using?

v1.5.1

Which operating system are you using?

Describe the issue

After a disconnection and reconnection of a stream (SDP through ffmpeg), MediaMTX crashes and we see the error "Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections, retrying in some seconds" in the browser page.

Describe how to replicate the issue

  1. Start the server
  2. Publish with SDP files over ffmpeg and check that it works. Stop the SDP streaming for 1h but leave MediaMTX on.
  3. Re-enable the SDP streams and the webpage with the streams does not reconnect and displays the error "Failed to construct 'RTCPeerConnection': Cannot create so many PeerConnections, retrying in some seconds" and it does not recover.

Did you attach the server logs?

no

Did you attach a network dump?

no

Example snippet from mediamtx.yml

MY-CAMERA:
    runOnInit: ffmpeg -protocol_whitelist "file,http,https,tcp,tls,rtp,udp" -i /opt/contoso/config_files/sdp_files/MY-CAMERA.sdp -c copy -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
    runOnInitRestart: yes

Contents of the MY-CAMERA.sdp file:

v=0
c=IN IP4 239.255.80.4
m=video 50040 RTP/AVP 96 
a=rtpmap:96 H264/90000