harlanc / xiu

A simple,high performance and secure live media server in pure Rust (RTMP[cluster]/RTSP/WebRTC[whip/whep]/HTTP-FLV/HLS).🦀
https://www.rustxiu.com
MIT License
1.6k stars 168 forks source link

Unable to stream via WHIP + OBS #111

Closed kaitlynia closed 3 months ago

kaitlynia commented 3 months ago

First of all, thank you so much for implementing a media server in Rust that supports WebRTC! Unfortunately, I'm having trouble getting it working.

v0.12.5, on Ubuntu 22.04.4 LTS, built using the GitHub release tag, Rust stable. Here is my config file:

[authsecret]
key = "KEY"
password = "PASSWORD"
##########################
# WebRTC configurations  #
##########################
[webrtc]
enabled = true
port = 8083
[webrtc.auth]
pull_enabled = false
push_enabled = true
algorithm = "simple"

I am attempting to stream via WHIP in OBS with the following URL:

http://example.com:8083/whip?app=live&stream=stream&token=PASSWORD

Here is the log:

[2024-03-30T03:29:13Z INFO  xwebrtc::webrtc] WebRTC server listening on tcp://0.0.0.0:8083
[2024-03-30T03:29:13Z INFO  xiu::api] Http api server listening on http://0.0.0.0:8000
[2024-03-30T03:29:16Z INFO  xwebrtc::session] 1:whip,2:live,3:stream
[2024-03-30T03:29:16Z INFO  streamhub] event data: {"Publish":{"identifier":{"webrtc":{"app_name":"live","stream_name":"stream"}},"info":{"id":"1711769356","pub_type":"PushWebRTC","notify_info":{"request_url":"","remote_addr":""}}}}
[2024-03-30T03:29:16Z INFO  streamhub] transceiver run success, idetifier: WebRTC - app_name: live, stream_name: stream
[2024-03-30T03:29:16Z INFO  webrtc::peer_connection] signaling state changed to have-remote-offer
[2024-03-30T03:29:16Z INFO  webrtc_ice::mdns] mDNS is using 224.0.0.251:5353 as dest_addr
[2024-03-30T03:29:16Z INFO  webrtc_mdns::conn] Looping and listening Ok(224.0.0.251:5353)
[2024-03-30T03:29:16Z INFO  webrtc::peer_connection] signaling state changed to stable
[2024-03-30T03:29:16Z INFO  webrtc_ice::agent::agent_internal] [controlled]: Setting new connection state: Checking
[2024-03-30T03:29:16Z WARN  webrtc_ice::agent::agent_gather] [controlled]: could not listen udp fe80::216:3eff:fea6:cb3b: io error: Invalid argument (os error 22)
[2024-03-30T03:29:16Z WARN  webrtc_ice::agent::agent_gather] [controlled]: could not listen udp fe80::42:4fff:fee5:5164: io error: Invalid argument (os error 22)
[2024-03-30T03:29:16Z INFO  webrtc::peer_connection] ICE connection state changed: checking
[2024-03-30T03:29:16Z INFO  xwebrtc::whip] Connection State has changed checking
[2024-03-30T03:29:21Z WARN  webrtc_ice::agent::agent_gather] [controlled]: could not get server reflexive address udp6 stun:stun.l.google.com:19302: deadline has elapsed
[2024-03-30T03:29:21Z INFO  webrtc_ice::agent::agent_internal] [controlled]: Setting new connection state: Connected
[2024-03-30T03:29:21Z INFO  webrtc::peer_connection] ICE connection state changed: connected
[2024-03-30T03:29:21Z INFO  xwebrtc::whip] Connection State has changed connected
[2024-03-30T03:29:21Z INFO  xwebrtc::whip] Ctrl+C the remote client to stop the demo
[2024-03-30T03:29:22Z INFO  webrtc::peer_connection] peer connection state changed: failed
[2024-03-30T03:29:22Z INFO  xwebrtc::whip] Peer Connection State has changed: failed
Peer Connection has gone to failed exiting: Done forwarding
[2024-03-30T03:29:22Z WARN  webrtc::peer_connection::peer_connection_internal] Failed to start manager dtls: Alert is Fatal or Close Notify
[2024-03-30T03:29:22Z WARN  webrtc::rtp_transceiver::rtp_receiver] RTPReceiver Receive failed the DTLS transport has not started yet
[2024-03-30T03:29:22Z WARN  webrtc::rtp_transceiver::rtp_receiver] RTPReceiver Receive failed the DTLS transport has not started yet
[2024-03-30T03:29:22Z WARN  webrtc::peer_connection::peer_connection_internal] undeclared_media_processor failed to open SrtcpSession
[2024-03-30T03:29:22Z WARN  webrtc::peer_connection::peer_connection_internal] undeclared_media_processor failed to open SrtpSession
[2024-03-30T03:29:22Z INFO  xwebrtc::session] 1:whip,2:live,3:stream
[2024-03-30T03:29:22Z WARN  webrtc_ice::agent::agent_internal] [controlled]: Failed to close candidate udp4 host 192.168.56.1:60862: the agent is closed
[2024-03-30T03:29:22Z WARN  webrtc_ice::agent::agent_internal] [controlled]: Failed to close candidate udp4 host 192.168.1.3:60862: the agent is closed
[2024-03-30T03:29:22Z WARN  webrtc_ice::agent::agent_internal] [controlled]: Failed to close candidate udp4 prflx 73.109.191.6:60862 related :0: the agent is closed
[2024-03-30T03:29:22Z INFO  webrtc_ice::agent::agent_internal] [controlled]: Setting new connection state: Closed
[2024-03-30T03:29:22Z INFO  webrtc::peer_connection] peer connection state changed: closed
[2024-03-30T03:29:22Z INFO  xwebrtc::whip] Peer Connection State has changed: closed
[2024-03-30T03:29:22Z INFO  xwebrtc::session] close peer connection successfully.
[2024-03-30T03:29:22Z INFO  webrtc::peer_connection] ICE connection state changed: closed
[2024-03-30T03:29:22Z INFO  xwebrtc::whip] Connection State has changed closed
[2024-03-30T03:29:22Z INFO  webrtc_mdns::conn] Closing server connection
[2024-03-30T03:29:22Z INFO  streamhub] event data: {"UnPublish":{"identifier":{"webrtc":{"app_name":"live","stream_name":"stream"}},"info":{"id":"1711769362","pub_type":"PushWebRTC","notify_info":{"request_url":"","remote_addr":""}}}}
[2024-03-30T03:29:22Z INFO  streamhub] unpublish remove stream, stream identifier: WebRTC - app_name: live, stream_name: stream
[2024-03-30T03:29:22Z INFO  streamhub::statistics] avstatistics shutting down

Any help with this is appreciated! :)

harlanc commented 3 months ago

Hi @kaitlynia

I have already attempted to fix this issue in my environment and release a new version. You can try again, and if you encounter any problems, please let me know.