roleoroleo / yi-hack-MStar

Custom firmware for Yi 1080p camera based on MStar platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0.4.9 snapshot issue

marcor2196 opened this issue · comments

Hi, after the 0.4.9 update, the HTTP call to the snapshot endpoint (/cgi-bin/snapshot.sh) respond with code 200 OK but the response it's empty, don't contain the image.

Also the snapshot page in the web control page of camera don't show the image but I imagine that the service it's the same.

commented

@marcor2196 For this issue, you can check issue #503 to see if it is the same issue you have, I commented on how to fix or bypass the failure in the thread.

Also the snapshot page in the web control page of camera don't show the image but I imagine that the service it's the same.

Updated to 0.5.0, I believe that the problem is not solved.

When I call the snapshot endpoint, the request sometimes remain pending and other times respond with empty result.

Other strange thing it's that the webserver needs the port 8080 to work, contrary to the changelog of the last update that say to use the 80.

image

commented

About the port, new 0.5.0 version doesn't change your configuration.
It changes only the default setting (for new installations).
If the problem is not solved, probably it's not the same problem described in #503

We can try to debug the problem.
Open a ssh connection with the cam and run the snapshot manually:
imggrabber -m $SUFFIX -r high -w -d > /tmp/test.jpg

Here the output:

I've removed the duplicated "copy again buffer" output, actually is repeated several times, more than 100 times roughly.

watermark on
debug on
Starting program
Resolution: 1080
VMFE0
vaddr: 0xb4b44000 - paddr: 0x235a0000 - size: 3502080
copy buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
copy again buffer: len 3502080
convert YUV image
Adding watermark
Encoding jpeg image
Free memory

With all the "copy again buffer" it took several minutes to end the command.

commented

With all the "copy again buffer" it took several minutes to end the command.

This is the problem.
I don't know why, probably imggrabeer doesn't have enough cpu to read the buffer fast enough.
I will check the code.

Meanwhile, could you try to disable all unnecessary processes and check again the command above?

I have only few thing active: RTSP, NTPD, MQTT and local recording with cloud disabled.
Other intensive processes are all deactivated.

Before upgrade to 0.5.0 I have downgraded to 0.4.8 from the 0.4.9 and work correctly.
So the problem was introduced in 0.4.9.

commented

Ok, try this binary and add another parameter to set process priority:
imggrabber.gz
imggrabber -m $SUFFIX -r high -w -p 0 -d > /tmp/test.jpg

I have tried your binary and with the new command the process is really fast, in one or two seconds it ended.

But if I tried without the parameter of process priority, the time needed it's the same as before.

commented

This means that the process doesn't have enough cpu.
I restored the default priority.
106f54b

Overwrite your /home/yi-hack/bin/imggrabber with this one:
imggrabber.gz

Overwrited the binary, now works correctly, also the snapshot endpoint.

Thank you so much for your time and the work :)