EliasKotlyar / Xiaomi-Dafang-Software

110 stars 59 forks source link

v4l2rtspserver-master fails when launching #21

Open tssva opened 6 years ago

tssva commented 6 years ago

When launching the v4l2rtspserver-master in the repo it fails with the following message.

i264e[info]: profile Constrained Baseline, level 3.1
/system/sdcard/bin/v4l2rtspserver-master: /home/ptkang/work/platform/isvp_20160504_e/proj/sdk-lv3/src/imp/ivs/ivs_move/src/filter.c: 156: Start: Assertion `filter->roi.x >= 0 && filter->roi.y >= 0 && filter->roi.width >= 0 && filter->roi.height >= 0 && filter->roi.x + filter->roi.width <= filter->wholeSize.width &&filter->roi.y + filter->roi.height <= filter->wholeSize.height' failed.
nik0 commented 6 years ago

this is strange logs. It seems that the detection filter is not well configured Did you compile by yourself ? what is the output of logcat command ?

EliasKotlyar commented 6 years ago

I suppose that it has something to do with the new updated binaries from a Xiaofang/WyzeCam 2. This error was already here when i was using some different binaries from the SDK.

See here for more details: https://github.com/EliasKotlyar/Xiaomi-Dafang-Software/issues/4

Can you try to deactivate the motion tracking?

tssva commented 6 years ago

Did you compile by yourself ?

I did compile it myself. I ran the compile scripts in the repo to build lame, opus, live555 and then v4l2rtspserver-master. The only changes I made were to the paths for the detection scripts called by v4l2rtspserver.

what is the output of logcat command?

D/IMP-ISP (  494): ~~~~~~ IMP_ISP_Open[267] ~~~~~~~
I/NCU     (  494): NCU Debug mode:0
E/NCU     (  494): open /etc/sensor/jxf22_nd.bin failed: No such file or directory
D/System  (  494): IMP_System_Init SDK Version:3.11.0-ab06d6d built: Nov 16 2017 21:42:57
D/System  (  494): system_init()
D/System  (  494): Calling DSystem
D/System  (  494): Calling FrameSource
D/System  (  494): [ignored]read /proc/cpuinfo ret is NULL
D/System  (  494): Calling IVS
D/System  (  494): Calling OSD
I/Alloc Manager(  494): MEM Alloc Method is kmalloc
D/KMEM Method(  494): CMD Line Rmem Size:33554432, Addr:0x06000000
D/KMEM Method(  494): alloc->mem_alloc.method = kmalloc
D/KMEM Method(  494):           alloc->mem_alloc.vaddr = 0x745fe000
D/KMEM Method(  494):           alloc->mem_alloc.paddr = 0x06000000
D/KMEM Method(  494):           alloc->mem_alloc.length = 33554432
I/Alloc Manager(  494): MEM Manager Method is continuous
D/System  (  494): Calling Encoder
I/Encoder (  494): IMP Alloc BS Buf size:2073600
D/Encoder (  494): ispmem Size:9437184, Addr:0x05700000
I/Encoder (  494): bank-0 paddr=05700000 vaddr=73cfe000 size=8221184
I/Encoder (  494): bank-1 paddr=05ed7200 vaddr=744d5200 size=1216000
D/System  (  494): Calling Decoder
D/System  (  494): Calling FB
D/Encoder (  494): channel-1 buffer malloc size=1386624 addr=0x71390008
D/Encoder (  494): channel-0 buffer malloc size=4159872 addr=0x70e46008
I/Encoder (  494): chn-0 NCU Info vaddr=73cfe000 paddr=05700000 size=460800 backv=73d6e800 backp=05770800 outv=73e4f800 outp=05851800 total_size=2304000
D/System  (  494): system_bind(): bind DST-OSD-0(4.0.0) to SRC-Framesource-0(0.0.0)
D/System  (  494): system_bind(): bind DST-Encoder-0(1.0.0) to SRC-OSD-0(4.0.0)
D/System  (  494): system_bind(): bind DST-IVS-0(3.0.0) to SRC-Framesource-0(0.0.0)
I/Framesource(  494): [chn0]: width = 1280 height = 720
E/VBM     (  494): VBMCreatePool()-0: w=1280 h=720 f=842094158
E/VBM     (  494): VBMCreatePool()-0: pool->config.fmt.fmt.pix.sizeimage=1382400 sizeimage=1382400
E/VBM     (  494): VBMCreatePool()-0: sizeimage=1382400
I/VBM     (  494): PoolId:0, frame=0x7fa378, frame->priv=0x7fa3a0, frame[0].virAddr=74ecc000, frame[0].phyAddr=68ce000
I/VBM     (  494): PoolId:0, frame=0x7fa3a8, frame->priv=0x7fa3d0, frame[1].virAddr=7501d800, frame[1].phyAddr=6a1f800
I/VBM     (  494): PoolId:0, frame=0x7fa3d8, frame->priv=0x7fa400, frame[2].virAddr=7516f000, frame[2].phyAddr=6b71000
D/System  (  494): [ignored]read /proc/cpuinfo ret is NULL

Can you try to deactivate the motion tracking?

It works properly with motion tracking deactivated.

nik0 commented 6 years ago

I found why you get /system/sdcard/bin/v4l2rtspserver-master: /home/ptkang/work/platform/isvp_20160504_e/proj/sdk-lv3/src/imp/ivs/ivs_move/src/filter.c: 156: Start: Assertion filter->roi.x >= 0 && filter->roi.y >= 0 && filter->roi.width >= 0 && filter->roi.height >= 0 && filter->roi.x + filter->roi.width <= filter->wholeSize.width &&filter->roi.y + filter->roi.height <= filter->wholeSize.height failed. You compiled with libimp.so (instead of libimp.a) which is newer code (new sdk version). The API changed a bit: there are now 16 detection areas (instead of 4). You need to change this define: file inc/imp/imp_ivs_move.h change #define IMP_IVS_MOVE_MAX_ROI_CNT 4 to #define IMP_IVS_MOVE_MAX_ROI_CNT 16

recompile et voila !

nik0

EliasKotlyar commented 6 years ago

That sounds awesome. They also have changed some Api-Names a bit, but everything seems to be similar to the "old" version. See https://github.com/EliasKotlyar/Xiaomi-Dafang-Software/commit/85e040d0517d503d86cf258bb5d33b4cb36561ab for more details.

EliasKotlyar commented 6 years ago

@nik0 : I found a new "leaked" source on github. It seems that it includes a fully featured Demo RTSP-Server. Can you please have a look? Dont have much time this week. I suppose that we can use it to improve the overall quality & stability. It also includes a lot of new code... https://github.com/beihuijie/carrier-rtsp-server

nik0 commented 6 years ago

I did a quick test, and I have this error capture_and_encoding( 268): IMP_System_Init() failed the error is not obvious (and it seems to freeze the cam) Why do you think the quality would be better ? The good news is that we have the last (or more recent) SDK lib + include. I made some adjustments (as some API changed) and it seems to work ... IMP_System_Init SDK Version:3.12.0-6f2a7d4 built: Mar 20 2018 18:53:49 I will push everything soon ...

EliasKotlyar commented 6 years ago

Hello @nik0 ,

I did a quick test, and I have this error capture_and_encoding( 268): IMP_System_Init() failed the error is not obvious (and it seems to freeze the cam)

Could you please check if you have the correct sensor uncommented in this file: https://github.com/beihuijie/carrier-rtsp-server/blob/master/imp-common.h

Why do you think the quality would be better ?

I suppose that the original firmware is using the compiled version of this "carrier" implementation. Because of that, I suppose that the overall quality/stability is better than in "our" implementation. They are using some different threading system(forking). Maybe its working better this way.

I will push everything soon ...

Thanks you for pushing. There is still some work to do(started working on sensor detection yesterday).

nik0 commented 6 years ago

You were right the sensor was not the good one But the camera is still stuck and I didn't succeed to see the image. I pushed the new sources and makefile

nik0 commented 6 years ago

Hi @EliasKotlyar , I noticed that removing the snap_jpeg in the main h264 loop improving the stability (I mean VLC won't lose the stream) For now I didn't put it back, but I guess that having a separate thread will improve it