RTSP server doesnt work with UDP transport
huiminghao opened this issue · 3 comments
XIU version
For example: v0.13.0
Describe the bug
RTSP server doesnt work with UDP transport.
To Reproduce
start xiu with:cargo run -- -t 8554
push with:./ffmpeg.exe -re -i /d/out.mkv -codec copy -f rtsp -rtsp_transport udp rtsp://172.19.116.34:8554/1
play with:./ffplay.exe rtsp://172.19.116.34:8554/1 -rtsp_transport udp
--neither--
push with:./ffmpeg.exe -re -i /d/out.mkv -codec copy -f rtsp -rtsp_transport tcp rtsp://172.19.116.34:8554/1
play with:./ffplay.exe rtsp://172.19.116.34:8554/1 -rtsp_transport udp
xiu
logs:
[2024-08-30T02:56:53Z INFO xrtsp::session::server_session] handle_play error: pack error: bytes write error: bytes io error: io error
[2024-08-30T02:56:53Z ERROR streamhub] Transmiter send error: send video error
[2024-08-30T02:56:53Z ERROR streamhub] Transmiter send error: send audio error
[2024-08-30T02:56:53Z ERROR streamhub] Transmiter send error: send audio error
[2024-08-30T02:56:53Z ERROR streamhub] Transmiter send error: send audio error
--neither--
push with:./ffmpeg.exe -re -i /d/out.mkv -codec copy -f rtsp -rtsp_transport udp rtsp://172.19.116.34:8554/1
play with:./ffplay.exe rtsp://172.19.116.34:8554/1 -rtsp_transport tcp
but works with:
push with:./ffmpeg.exe -re -i /d/out.mkv -codec copy -f rtsp -rtsp_transport tcp rtsp://172.19.116.34:8554/1
play with:./ffplay.exe rtsp://172.19.116.34:8554/1 -rtsp_transport tcp
Expected behavior
UDP transport works.
问题解决了。rtsp的请求响应时,创建UDP的sock使用的remote address是从request uri里面获取的。这边使用ffmpeg测试,这个uri是服务器的地址。
补丁的内容见:https://github.com/huiminghao/xiu/commit/fbfca9164c41b0100e2221ab7feca0388e7535d8
补丁其他相关的:#147
@huiminghao 方便提交一个pull request嘛