ipcam-view icon indicating copy to clipboard operation
ipcam-view copied to clipboard

About mjpeg stream crash problem at VIVO 7+ phone

Open jcRuan opened this issue 7 years ago • 7 comments

we got a problem at "VIVO 7 plus" phone, when preview the mjpeg stream and than the APP will crash, we record the log following :

{"date":"2018-09-04-10:25:31","exception":" java.lang.IllegalArgumentException: Malformed \uxxxx encoding. java.util.Properties.loadConvert(Properties.java:569) java.util.Properties.load0(Properties.java:392) java.util.Properties.load(Properties.java:342) com.github.niqdev.mjpeg.MjpegInputStreamDefault.parseContentLength(MjpegInputStreamDefault.java:63) com.github.niqdev.mjpeg.MjpegInputStreamDefault.readMjpegFrame(MjpegInputStreamDefault.java:75) com.github.niqdev.mjpeg.MjpegViewDefault$MjpegViewThread.run(MjpegViewDefault.java:141) "}

but at others phones (SONY XZ2 or SONY Z1 or Samsung .... etc) no this problem and work well, we saw #38 and #65 issues and than the problem doesn't be solve.

anyone has any idea?

jcRuan avatar Sep 04 '18 06:09 jcRuan

Hi, if for the same url and 2 different devices you have a different behaviour, do you have the possibility to debug those lines and see why it blows up?

niqdev avatar Sep 04 '18 20:09 niqdev

@jcRuan not sure if it's related, but there is also an open PR #27 , you might want to investigate that too

niqdev avatar Sep 04 '18 21:09 niqdev

@niqdev thank you, we will try #27 way.

jcRuan avatar Sep 06 '18 01:09 jcRuan

I'm doing some cleanup regarding old issues, @jcRuan did #27 help?

niqdev avatar Dec 02 '18 16:12 niqdev

Not sure if you got to the bottom of this but I think I had this issue with binary vs text/ascii when using java properties to get some of the header fields from the stream. I had to change the yield in the python flask server to ensure that all the header fields were sent as ascii to prevent this crash happening - this is technically the correct format for mjpeg but browsers are more forgiving and take the binary for headers, the java properties gives the exception above though:

frame = camera.get_frame() content_length = len(frame) yield ('--frame\r\n') yield ('Content-Type:image/jpeg\r\n') yield('Content-Length:' + str(content_length) + '\r\n') yield ('\r\n') yield (frame) yield ('\r\n')

As you can see only the frame is binary and this is the expected mjpeg format.

treefrogsoftware avatar Dec 27 '18 20:12 treefrogsoftware

Thanks @treefrogsoftware for your hint, out of curiosity, is the flask server open-source or if is not too complicated, can you create a gist with its main implementation so that might can help someone else?

niqdev avatar Dec 28 '18 09:12 niqdev

If added a mini project using python its for a raspberry PI camera but could be quickly adapted: https://github.com/treefrogsoftware/mjpeg_flask

treefrogsoftware avatar Dec 28 '18 14:12 treefrogsoftware