EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

Lots of "err sensor read addr" in dmesg while starting rtsp service, stream failing to open in mpv #1643

Closed zaskokus closed 3 years ago

zaskokus commented 3 years ago

Camera: Xiaomi Dafang Version: beta branch, commits from Nov.

Upon starting/restarting rtsp service I'm getting plenty of (like 10x more):

[22259.854870] jxf22 stream off
[22259.856285] do not support ctrl->cmd ====0
[22356.773994] name : i2c-gpio1 nr : 1
[22356.777616] name : i2c0 nr : 0
[22356.841799] i2c i2c-0: i2c_jz_irq 441, I2C transfer error, ABORT interrupt
[22356.848962] i2c i2c-0: --I2C txabrt:
[22356.852673] i2c i2c-0: --I2C TXABRT[0]=I2C_TXABRT_ABRT_7B_ADDR_NOACK
[22356.859290] error: sensor_read,172 ret = -5
[22356.863637]  sensor_read: addr=0xa value = 0x0
[22356.868242] err sensor read addr = 0xa, value = 0x0
[22356.933459] i2c i2c-0: i2c_jz_irq 441, I2C transfer error, ABORT interrupt
[22356.940659] i2c i2c-0: --I2C txabrt:
[22356.944505] i2c i2c-0: --I2C TXABRT[0]=I2C_TXABRT_ABRT_7B_ADDR_NOACK

The rtsp is running, but when I try to connect via mpv I get nothing but

[ffmpeg/video] h264: error while decoding MB 3 30, bytestream -7

or

[ffmpeg/video] h264: non-existing PPS 0 referenced
[ffmpeg/video] h264: non-existing PPS 0 referenced
[ffmpeg/video] h264: decode_slice_header error
[ffmpeg/video] h264: no frame!

The vlc doesn't like the stream either - it either doesn't connect at all or yelds a single frame that's very broken.

The issue is happening for quite a time (both master and beta branches, tried two cameras with two different SD cards). Once every plenty reboots it does work, then the stream is stable for up to an hour, but reconnecting via mpv restores the video correctly... until it breaks again. Most of the time I get black screen and that's it. It sometimes gets more moody, like with a phase of the moon or something ;-)

janlukes commented 3 years ago

Same here, but on master.

ryaske commented 3 years ago

I think the error on sensor read has to do with the motor controllers. I notice around 14 seconds after the boot (in the dmesg log) I see

[13.840046] err sensor read addr = 0x0, value = 0x0 [ 13.905383] i2c i2c-0: i2c_jz_irq 441, I2C transfer error, ABORT interrupt [ 13.912531] i2c i2c-0: --I2C txabrt: [ 13.916240] i2c i2c-0: --I2C TXABRT[0]=I2C_TXABRT_ABRT_7B_ADDR_NOACK [ 13.922853] error: sensor_read,172 ret = -5 [ 13.927188] sensor_read: addr=0x300a value = 0x0 [ 13.932063] err sensor read addr = 0x300a, value = 0x0 [ 13.999652] sensor_read: addr=0xa value = 0xf [ 14.004693] sensor_read: addr=0xb value = 0x22 [ 14.009393] info: success sensor find : jxf22 [ 14.014010] misc sinfo_release [ 14.020178] set sensor gpio as PA-low-10bit [ 14.026620] probe ok ------->jxf22 [ 14.052471] -----jxf22_detect: 432 ret = 0, v = 0x0f [ 14.052972] -----jxf22_detect: 440 ret = 0, v = 0x22 [ 14.052986] jxf22 0-0040: jxf22 chip found @ 0x40 (i2c0) [ 14.058560] tx_isp: Registered sensor subdevice jxf22 0-0040

Which makes me think this is how long it takes for the subsystem to boot up and the errors in this log prior to that, about not finding the sensors yet, is unrelated to your problem. I will have an expert weigh in there since I am definitely just guessing.

But I wanted to say that I have the same problem with VLC. I find this happens if I set the bitrate or frame rate too high. I have to set it down to something like 500kb/s and 10frames per second max for VLC to be happy about it and display. This doesn't stop the disconnection / reloading that frequently happens, though I found FixedQP to work a little more stably then the VBR I was using before. This same thing happens to me on a version from 8/21/2020(the only one I've found stable so far) as well as the latest 50a937c (in which timelapse and recording don't even seem to work at all)

zaskokus commented 3 years ago

Right, I noticed that smaller bitrates are working somewhat better, but currently I'm at something crazy low 1024kbps, 720p, 20fps and the disconnect issue is still very apparent. Now the dmesg message apperas upon every restart of v4l2rtspserver-master service - so it is not related to the boot process itself.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.