Open Clemens-E opened 3 days ago
I had good results with this logic: If the connection has not recovered within 2 seconds I issue a full reconnect.
In most cases the connection recovers in less than 100ms, this handles the rare cases where it does not.
same problem
2024/10/04 07:52:23 DEB [path 26.cam] [RTSP source] [c->s] TEARDOWN rtsp://10.104.11.26/1 RTSP/1.0 Authorization: Digest username="admin", realm="Surveillance Server", nonce="35909642", uri="rtsp://10.104.11.26/1", response="e05ac445e464c48ff7e563023655ce33" CSeq: 6 Session: 50360028 User-Agent: gortsplib
2024/10/04 07:52:23 DEB [WebRTC] [conn 172.30.0.19:62711] [s->c] HTTP/1.1 204 No Content Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: Authorization, Content-Type, If-Match Access-Control-Allow-Methods: OPTIONS, GET, POST, PATCH, DELETE Access-Control-Allow-Origin: * Access-Control-Expose-Headers: Link Server: mediamtx
2024/10/04 07:52:23 DEB [path 26.cam] [RTSP source] [c->s] OPTIONS rtsp://26.cam.resp204k7.itstroy.pro:554/1 RTSP/1.0 CSeq: 1 User-Agent: gortsplib
2024/10/04 07:52:23 DEB [WebRTC] [conn 172.30.0.19:62711] [c->s] OPTIONS /6.cam/whep HTTP/1.1 Host: resp204k7.itstroy.pro:8889 Accept: / Accept-Encoding: gzip, deflate Accept-Language: ru-RU,ru;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6 Connection: keep-alive Dnt: 1 Origin: http://resp204k7.itstroy.pro:8889 Referer: http://resp204k7.itstroy.pro:8889/6.cam/ User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
2024/10/04 07:52:23 DEB [WebRTC] [conn 172.30.0.19:62711] [s->c] HTTP/1.1 204 No Content Access-Control-Allow-Credentials: true Access-Control-Allow-Headers: Authorization, Content-Type, If-Match Access-Control-Allow-Methods: OPTIONS, GET, POST, PATCH, DELETE Access-Control-Allow-Origin: * Access-Control-Expose-Headers: Link Server: mediamtx
Which version are you using?
1.9.1
Which operating system are you using?
Linux arm64 standard
Describe how to replicate the issue
I'm streaming 6 Cameras using WebRTC over a TURN server. Every 1-2 Minutes, each stream displays "peer connection closed", then it loads for 5 Seconds until it has been reconnected. The connection was running over LTE so I expected some connection issues, but not this frequent.
My observation: The Javascript in read_index.html terminates a connection when its state changes to "disconnected".
However RTCPeerConnection/iceConnectionState#disconnected says:
I removed the above-mentioned code that triggers a full reconnect when the state changes to "disconnected", and instead added a console.log with Date.now and the iceConnectionState. After waiting for a bit, I got following log:
Showing it took about 54ms before the connection resumed My proposal would be using the "failed" state, or re-checking if the connection returns to "connected" within a certain time frame.
Steps to reproduce:
Server logs
No response
Network dump
No response