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

rtmp 建立连接时 panic #66

Closed
ningnao opened this issue Oct 25, 2023 · 7 comments · Fixed by #69
Closed

rtmp 建立连接时 panic #66

ningnao opened this issue Oct 25, 2023 · 7 comments · Fixed by #69
Labels
bug Something isn't working

Comments

@ningnao
Copy link
Contributor

ningnao commented Oct 25, 2023

设备是一个支持 rtmp 功能的监控摄像头,建立连接时出现以下错误

[2023-10-25T09:45:23Z INFO  h264_decoder::sps] level_idc: 51
thread 'tokio-runtime-worker' panicked at library/codec/h264/src/sps.rs:105:63:
index out of bounds: the len is 0 but the index is 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@harlanc
Copy link
Owner

harlanc commented Oct 25, 2023

感谢指出问题,XIU的版本?可以提供能复现问题的录制文件吗? flv格式的就可以

@ningnao
Copy link
Contributor Author

ningnao commented Oct 25, 2023

感谢指出问题,XIU的版本?可以提供能复现问题的录制文件吗? flv格式的就可以

用的是master分支(65c8def)

复现视频可以用这个

ffmpeg命令

.\ffmpeg -re -stream_loop -1 -i test.mp4 -c:a copy -c:v copy -f flv -flvflags no_duration_filesize rtmp://127.0.0.1:1935/live/test

@harlanc
Copy link
Owner

harlanc commented Oct 25, 2023

Please replace the 105th line of sps.rs

self.sps.seq_scaling_list_present_flag[i] = self.bits_reader.read_bit()?;

with

self.sps.seq_scaling_list_present_flag.push(self.bits_reader.read_bit()?);

and try again..

@harlanc harlanc added the bug Something isn't working label Oct 25, 2023
@ningnao
Copy link
Contributor Author

ningnao commented Oct 26, 2023

替换该行后问题解决

@ningnao
Copy link
Contributor Author

ningnao commented Oct 26, 2023

我这个设备在连接成功后,xiu会在每个I帧重复输出以下内容
这是预期行为吗

[2023-10-26T01:04:27Z INFO  rtmp::cache::metadata] metadata: [UTF8String("onMetaData"), Object({"duration": Number(0.0), "width": Number(1920.0), "height": Number(1080.0), "framerate": Number(25.0), "videocodecid": Number(7.0), "encoder": UTF8String("Lavf54.63.100"), "filesize": Number(0.0), "videodatarate": Number(195.313)})]
[2023-10-26T01:04:27Z INFO  h264_decoder::sps] profile_idc: 100
[2023-10-26T01:04:27Z INFO  h264_decoder::sps] level_idc: 51
[2023-10-26T01:04:27Z INFO  xflv::mpeg4_avc] mpeg4 avc profile: 100
[2023-10-26T01:04:27Z INFO  xflv::mpeg4_avc] mpeg4 avc compatibility: 0
[2023-10-26T01:04:27Z INFO  xflv::mpeg4_avc] mpeg4 avc level: 51
[2023-10-26T01:04:27Z INFO  xflv::mpeg4_avc] mpeg4 avc resolution: 1920x1080

@harlanc
Copy link
Owner

harlanc commented Oct 26, 2023

通常RTMP流推流端只需要发送一次metaData 和 sequence header,看你的描述应该是每个I帧都会发送一次,xiu会把每次收到的最新的metaData和sequence header保存下来,这个是符合预期的

@ningnao
Copy link
Contributor Author

ningnao commented Oct 26, 2023

了解了 感谢回复!

@harlanc harlanc linked a pull request Oct 27, 2023 that will close this issue
@ningnao ningnao mentioned this issue Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants