pion / webrtc

Pure Go implementation of the WebRTC API
https://pion.ly
MIT License
13.9k stars 1.66k forks source link

Pion drops connection to OME after few seconds #2607

Open wildfluss opened 1 year ago

wildfluss commented 1 year ago

Pion seemingly connects to OME https://github.com/AirenSoft/OvenMediaEngine

ome-to-pion-ome-1             | [2023-10-26 15:00:42.273] I [SPICE-t3478:19] ICE | ice_port.cpp:606  | Turn client has connected : <ClientSocket: 0xffff8f907010, #36, Connected, TCP, Nonblocking, 172.23.0.4:50068>

but after few seconds drops the connection

ome-to-pion-ome-1             | [2023-10-26 15:00:42.276] I [SPRtcSig-t3333:10] Monitor | stream_metrics.cpp:114  | A new session has started playing #default#app/fixme on the WebRTC publisher. WebRTC(1)/Stream total(1)/App total(1)
ome-to-pion-ome-1             | [2023-10-26 15:00:42.276] I [SPRtcSig-t3333:10] ICE | ice_port.cpp:368  | Added session: 0 (ufrag: qj2PGt:ghrTrwNEJpQijbMf)
ome-to-pion-webrtc-pion-1     | 2023/10/26 15:00:47 Blocking forever
ome-to-pion-ome-1             | [2023-10-26 15:01:12.408] I [SPICE-t3478:19] ICE | ice_port.cpp:620  | Turn client has disconnected : <ClientSocket: 0xffff8f907010, #36, Disconnected, TCP, Nonblocking, 172.23.0.4:50068>
ome-to-pion-webrtc-pion-1     | Peer Connection State has changed: failed
ome-to-pion-webrtc-pion-1     | Peer Connection has gone to failed exiting
ome-to-pion-ome-1             | [2023-10-26 15:01:12.420] I [DQICETmout:13] ICE | ice_port.cpp:436  | Removed session(0) from ICEPort | ice_seesions_with_id count(0) ice_sessions_with_ufrag(0) ice_sessions_with_address_pair(0) 
ome-to-pion-ome-1             | [2023-10-26 15:01:12.420] I [DQICETmout:13] WebRTC Publisher | webrtc_publisher.cpp:649  | IcePort is disconnected. : (#default#app/fixme/100) reason(6)
ome-to-pion-ome-1             | [2023-10-26 15:01:12.420] I [DQICETmout:13] WebRTC Publisher | webrtc_publisher.cpp:551  | Stop command received : #default#app/fixme/100
ome-to-pion-ome-1             | [2023-10-26 15:01:12.420] W [DQICETmout:13] ICE | ice_port.cpp:527  | Agent [Unknow, 0] has expired
ome-to-pion-ome-1             | [2023-10-26 15:01:12.421] I [DQICETmout:13] Monitor | stream_metrics.cpp:136  | A session has been stopped playing #default#app/fixme on the WebRTC publisher. Concurrent Viewers[WebRTC(0)/Stream total(0)/App total(0)]
ome-to-pion-ome-1             | [2023-10-26 15:01:12.421] I [DQICETmout:13] Signalling | rtc_signalling_server.cpp:450  | Client is disconnected: HttpConnection(0xffff8c801010) : WebSocket <ClientSocket: 0xffff8f840a10, #34, Connected, TCP, Nonblocking, 172.23.0.4:58704> TLS(Disabled) (#default#app / fixme, ufrag: local: qj2PGt, remote: ghrTrwNEJpQijbMf)
ome-to-pion-ome-1             | [2023-10-26 15:01:12.504] I [SPRtcSig-t3333:10] HTTP.Server | http_server.cpp:216  | Client(<ClientSocket: 0xffff8f840a10, #34, Closed, TCP, Nonblocking, 172.23.0.4:58704>) has been disconnected by *:3333

Repro is here https://github.com/wildfluss/ome-to-pion which is basically reflect example but with OME signaling and few tweaks which I've tried to do by reading other examples (eg unreal-pixel-streaming from example-webrtc-applications )

Disclaimer: I'm WebRTC n00b

adriancable commented 6 months ago

@wildfluss - did you ever get to the bottom of this? I am having an issue that seems superficially similar (disconnects after exactly 30 seconds), only the remote is using libjuice not OME. It appears at least in my case that the connection is actually being dropped by the remote (DTLS CloseNotify comes from the remote) with Pion, but with Chrome all is OK. I suspect that Pion is not doing something quite right with keepalives, but despite looking into this for several days and looking at tcpdumps I haven't been able to figure it out.

wildfluss commented 6 months ago

I suspect that Pion is not doing something quite right with keepalives

@adriancable , unfortunately, same here, Pion lacks documentation and I could not figure out what was that in about a day and gave up on using it, otherwise could be great library but taking into account amount of net layers involved in the protocol it would just take far too long to understand whether its Pion not compliant / remote is funky or what you know :(