niqdev / ipcam-view

MJPEG video streaming on Android
https://goo.gl/a2HM8C
MIT License
405 stars 160 forks source link

Crash mjpeg stream from DLINK 930 L #38

Open jaumard opened 7 years ago

jaumard commented 7 years ago

I tried this library with 3 different stream and camera, works for 2 of them but the third crash :( It's a D-LINK 930 LB camera, stream works fine from web browser or there Android app but make MjpegSurfaceView crash.

Here is the full log:

MjpegViewDefault: encountered exception during render
                                                                  java.io.IOException: Resetting to invalid mark
                                                                      at java.io.BufferedInputStream.reset(BufferedInputStream.java:437)
                                                                      at java.io.FilterInputStream.reset(FilterInputStream.java:226)
                                                                      at com.github.niqdev.mjpeg.MjpegInputStreamDefault.readMjpegFrame(MjpegInputStreamDefault.java:76)
                                                                      at com.github.niqdev.mjpeg.MjpegViewDefault$MjpegViewThread.run(MjpegViewDefault.java:129)

                                                                  --------- beginning of crash
06-05 18:49:40.539 5917-5970/com.jaumard.lisa E/AndroidRuntime: FATAL EXCEPTION: Thread-5
                                                                Process: com.jaumard.lisa, PID: 5917
                                                                java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
                                                                    at java.util.Properties.loadConvert(Properties.java:569)
                                                                    at java.util.Properties.load0(Properties.java:392)
                                                                    at java.util.Properties.load(Properties.java:342)
                                                                    at com.github.niqdev.mjpeg.MjpegInputStreamDefault.parseContentLength(MjpegInputStreamDefault.java:60)
                                                                    at com.github.niqdev.mjpeg.MjpegInputStreamDefault.readMjpegFrame(MjpegInputStreamDefault.java:72)
                                                                    at com.github.niqdev.mjpeg.MjpegViewDefault$MjpegViewThread.run(MjpegViewDefault.java:129)

Any idea ?

jaumard commented 7 years ago

should be nice to at least catch this exception and show a "no compatible stream" or something

niqdev commented 7 years ago

Hi, is the camera public? there is any way I can reproduce the error? Thanks

jaumard commented 7 years ago

It's not public but I can open it for some time in order to be able to reproduce the crash. Can I have your email to send you the stream link ? To reproduce it's simple just try to read the stream, for me it crash directly without showing any images

zxc2694 commented 7 years ago

I also met this problem during using a D-LINK DCS-5020L camera. So sad.

zxc2694 commented 7 years ago

@jaumard Could you please share which ipcam can be used fine?

jaumard commented 7 years ago

I test with a PS3 eye on a raspberry pi and a raspberry pi with the official cam module (with mjpg_streamer). I don't have ipcam except the D-LINK.

niqdev commented 7 years ago

Hi, have a look at #35 and #32 and let me know if you have the same error, if it works would be nice to add/wrap another implementation

jaumard commented 7 years ago

I test #32 no error but no stream lol only blank, I try this library with some public mjpeg stream and when it work it take 10 secondes before showing the first frame... For #35 how can I test this code without building the all library source ? is it possible ?

niqdev commented 7 years ago

Good to know about #32, for #35 I haven't tried the code, but i think the only way for test it would be to download the project, add it to the source, try with the demo app and make a PR if it works.

vvarock commented 7 years ago

Ip camera and mobile connect in same network?

jaumard commented 7 years ago

Yes they are also try on another network too but same problem

vvarock commented 7 years ago

Try on same network but it's showing error

zxc2694 commented 7 years ago

Hi, I can use #32 to show public IPCAMs, except my DLINK camera. I don't know what the problem is. But I find DLINK camera view can be fine displayed on WebView. It's another method to show ipcam view.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    String myURL = "http://XXXXXXXXX";
    WebView myBrowser=(WebView)findViewById(R.id.mybrowser);

    WebSettings websettings = myBrowser.getSettings();
    websettings.setSupportZoom(true);
    websettings.setBuiltInZoomControls(true);
    websettings.setJavaScriptEnabled(true);

    myBrowser.setWebViewClient(new WebViewClient());

    myBrowser.loadUrl(myURL);
}
vvarock commented 7 years ago

Unfortunately ip cam demo has stopped how to solve this error

niqdev commented 7 years ago

@vvarock your comments are not constructive, unrelated to the issues and not explanatory, you can't spam and add comments everywhere asking for help if you don't explain your problem, provide a sample of the code and a stacktrace

niqdev commented 7 years ago

@zxc2694 Thanks for sharing, is the format of your stream MJPEG? cos this library supports only that format. I think your solution could be a valid alternative to the unsupported format. For example in issue #36 there was a similar problem and after spending time debugging the format was mpjpeg which is not supported

zxc2694 commented 7 years ago

Yes, my ipcam is also MJPEG streaming, and I think #36 problem is the same as mine. I don't know how to fix this incompatible problem from this library, so I use another alternative solution.

niqdev commented 5 years ago

Hi @zxc2694 , since @jcRuan had a similar issue, if you solve it, would you like to share what was your alternative solution? Thanks