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

fix: rtmp server failing to connect when auth is configured #131

Closed radiohertz closed 1 month ago

radiohertz commented 1 month ago

Fix 1: the app name contains the whole query param for whatever reason, this patch removes it.

Fix 2: somehow the query parameters passed to on_connect function are empty even though they exist and the auth fails because it thinks there's no token even tho there is, i just use the connect_properties url to get the required info instead.

radiohertz commented 1 month ago

cc @harlanc

harlanc commented 1 month ago

@radiohertz Thank you for your contributions. The fix for BUG 1 is good, although it's a bit unusual to see a case where the app name includes query parameters. As for BUG 2, I need to confirm whether the query parameters are empty or if the entire 'stream_name_with_query' field is empty?

The following picture is from ffmpeg pushing : image

radiohertz commented 1 month ago

I need to confirm whether the query parameters are empty or if the entire 'stream_name_with_query' field is empty?

I encountered the bug when i was pushing the stream using OBS on Linux. maybe OBS is doing something funny, but if im correct OBS still uses ffmpeg under the hood so im not really sure. @harlanc

harlanc commented 1 month ago

You'd better provide the captured RTMP network packets to do some analysis @radiohertz

radiohertz commented 1 month ago

Here's a screenshot, as you can see it's an empty string. The URL i configured in OBS is rtmp://127.0.0.1:1935/live/x0?token=test123 @harlanc

image

You can download the capture here https://files.evsky.art/rtmpcap.pcapng

harlanc commented 1 month ago

I use ffmpeg to push the stream to xiu server, using the following address: rtmp://127.0.0.1:1935/live/x0?token=test123, and the captures:

image

image

Abnormal packet capture records from @radiohertz :

image

image

radiohertz commented 1 month ago

@harlanc updated the patch and the changelog. I'd appreciate it if you can do a release on crates.io.

harlanc commented 1 month ago

okay, will do it on the weekend..

radiohertz commented 1 month ago

ping @harlanc

harlanc commented 1 month ago

Done @radiohertz