hypeapps/Endoscope

Crashes when I try to ffplay it when video size is unsupported

vi opened this issue · 4 comments

vi commented
8-09 21:56:52.510 I/CameraCapFrontMirror( 2387): [CAMERA_PARAM] env->mFrontMirror = 0
08-09 21:56:52.510 D/CameraPermission(15019): CameraPermission
08-09 21:56:52.515 E/StubController(15019): service = null
08-09 21:56:52.515 D/VideoStream(15019): Unlocking camera
08-09 21:56:52.515 D/CameraPermission(15019): CameraPermission
08-09 21:56:52.515 E/StubController(15019): service = null
08-09 21:56:52.525 I/MediaRecorderJNI(15019): prepare: surface=0x78793878
08-09 21:56:52.525 I/MediaRecorder(15019): start
08-09 21:56:52.530 D/IMG-OMX ( 2387): Loaded OMX.IMG.TOPAZ.VIDEO.Encoder (0xb76ea148) from libomx_vxe.so
08-09 21:56:52.530 E/IMGTOPAZ( 2387): Error in OTE_Video_GetParameter at line 499
08-09 21:56:52.530 D/IMG-OMX ( 2387): Removed 0xb76ea148 from libomx_vxe.so
08-09 21:56:52.535 D/CameraSource( 2387): Camera does not support setVideoSize()
08-09 21:56:52.535 E/CameraSource( 2387): Video dimension (800x480) is unsupported
08-09 21:56:52.535 E/MediaRecorder(15019): start failed: -19
08-09 21:56:52.540 W/dalvikvm(15019): threadid=13: thread exiting with uncaught exception (group=0x41591c50)
08-09 21:56:52.540 E/AndroidRuntime(15019): FATAL EXCEPTION: Thread-1303
08-09 21:56:52.540 E/AndroidRuntime(15019): Process: pl.hypeapp.endoscope, PID: 15019
08-09 21:56:52.540 E/AndroidRuntime(15019): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.os.Handler.<init>(Handler.java:200)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.os.Handler.<init>(Handler.java:114)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.app.Dialog.<init>(Dialog.java:109)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.app.Dialog.<init>(Dialog.java:149)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.support.v7.app.AppCompatDialog.<init>(AppCompatDialog.java:43)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.support.v7.app.AlertDialog.<init>(AlertDialog.java:95)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at android.support.v7.app.AlertDialog$Builder.create(AlertDialog.java:927)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at pl.hypeapp.endoscope.StartStreamActivity.logError(StartStreamActivity.java:224)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at pl.hypeapp.endoscope.StartStreamActivity.onError(StartStreamActivity.java:168)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at net.majorkernelpanic.streaming.rtsp.RtspServer.postError(RtspServer.java:300)
08-09 21:56:52.540 E/AndroidRuntime(15019):     at net.majorkernelpanic.streaming.rtsp.RtspServer$WorkerThread.run(RtspServer.java:410)
08-09 21:56:52.545 W/ActivityManager( 3216):   Force finishing activity pl.hypeapp.endoscope/.StartStreamActivity

You can try change dimension in settings.

vi commented

It should not crash even with wrong settings. It should show some error/warning message and/or work.

The program in general doesn't look reliable.

@vi Supporting many devices and programs is hard work. This is difficulty when whole program depends on external libraries like libstreaming. On my android 5.0 app works well. I am working on update which eliminates bugs and improve app experience.

Pkg: pl.hypeapp.endoscope
Exception: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare
Exception Category: Android constraint
Root cause: In method "pl.hypeapp.endoscope.StartStreamActivity.logError", it trying to create a dialog in a background thread -- WorkerThread, which has no looper by default, and "android.app.Dialog" will initially make new handler() to handle message, but without a looper, thus throwing such exception.
Description: only the main thread can create object Looper by default. If other threads directly use new handler() without calling Looper.prepare(), the exception will be thrown.
Possible Fixes:
1: Excute on UI thread (onPostExecute(), runOnUiThread()),especially for Dialog and Toast.makeText.
2: New Handler(context.getMainLooper())
3: Call Looper.prepare() and Looper.loop() before handle message

I'm looking forward to your reply.