Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when RTSP #150

Open
sunnysab opened this issue Aug 31, 2024 · 4 comments
Open

Crash when RTSP #150

sunnysab opened this issue Aug 31, 2024 · 4 comments

Comments

@sunnysab
Copy link

XIU version
For example: v0.13.0

Describe the bug
Crash when RTSP stream returning audio without encoding_name???

使用时发现 xiu 抛出错误,设备是 unv 的网络摄像头:

xiu -c xiu.toml
[2024-08-31T05:24:34Z INFO  xrtsp::relay::pull_client_manager] push client run...
[2024-08-31T05:24:34Z INFO  xrtsp::rtsp] Rtsp server listening on tcp://0.0.0.0:1554
[2024-08-31T05:24:34Z INFO  hls::server] Hls server listening on http://0.0.0.0:18080
[2024-08-31T05:24:34Z INFO  xiu::api] Http api server listening on http://0.0.0.0:8000
[2024-08-31T05:24:39Z INFO  xrtsp::relay::pull_client_manager] publish stream_path: /
[2024-08-31T05:24:39Z INFO  xrtsp::session::client_session] rtsp client: send_options
[2024-08-31T05:24:39Z INFO  xrtsp::session::client_session] support methods: OPTIONS,DESCRIBE,SETUP,PLAY,PAUSE,TEARDOWN,ANNOUNCE,SET_PARAMETER,GET_PARAMETER
[2024-08-31T05:24:39Z INFO  xrtsp::session::client_session] rtsp client: send_describe
[2024-08-31T05:24:39Z INFO  xrtsp::session::client_session] video codec info: RtspCodecInfo { codec_id: H264, payload_type: 105, sample_rate: 90000, channel_count: 0 }
thread 'tokio-runtime-worker' panicked at /home/sunnysab/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/xrtsp-0.3.0/src/session/client_session.rs:406:26:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

于是找到相关代码:

402             match media_name.as_str() {
403                 "audio" => {
404                     let codec_id = rtsp_codec::RTSP_CODEC_NAME_2_ID
405                         .get(&media.rtpmap.encoding_name.to_lowercase().as_str())
406                         .unwrap()
407                         .clone();

我也不知道为啥这个流没有名字。VLC、ffmpeg 正常。 ffplay 的信息为:

Input #0, rtsp, from 'rtsp://admin:[email protected]':  0B 
  Metadata:
    title           : VCP IPC Realtime stream
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn
  Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
  Stream #0:2: Data: none
[h264 @ 0x7bbe9c101840] SEI type 5 size 283 truncated at 241
[swscaler @ 0x7bbe8cc24a80] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 3 times
   2.17 A-V: -0.023 fd=   0 aq=    7KB vq=    1KB sq=    0B

应该是上游的问题,不过这个问题真的很无语……

@sunnysab
Copy link
Author

不要点击上面评论中的链接。病毒。
Don't click on the links in the comments above. Virus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@sunnysab and others