Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved cameraview #361

Merged
merged 5 commits into from
Feb 7, 2019
Merged

improved cameraview #361

merged 5 commits into from
Feb 7, 2019

Conversation

n8fr8
Copy link
Member

@n8fr8 n8fr8 commented Feb 6, 2019

using: https://github.com/natario1/CameraView

this should help address issues like #360 #355 and others

@n8fr8 n8fr8 added this to the Current Sprint milestone Feb 6, 2019
Copy link
Collaborator

@lukeswitz lukeswitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved: #355 | #360
Unresolved: #342 | #347

Huge improvements here! This library has great flexibility and support down to API 15; perfect choice. Not seeing crashes with regular use, aside from the two below:

1) Crash on CameraConfigureActivity from SettingsFragment.

Notes: Works without issue when accessed from ListActivity & MonitorActivity

Applicable Logs:

02-07 10:22:14.391 3646-3946/org.havenapp.main W/CameraBase: An error occurred while connecting to camera: 1
02-07 10:22:14.391 3646-3946/org.havenapp.main E/Camera1: createCamera: Failed to connect. Maybe in use by another app?
02-07 10:22:14.393 3646-3946/org.havenapp.main E/CameraController: uncaughtException: Interrupting thread with state: STATE_STARTING due to CameraException: com.otaliastudios.cameraview.CameraException: java.lang.RuntimeException: Fail to connect to camera service
    com.otaliastudios.cameraview.CameraException: java.lang.RuntimeException: Fail to connect to camera service
        at com.otaliastudios.cameraview.Camera1.createCamera(Camera1.java:218)
        at com.otaliastudios.cameraview.Camera1.onStart(Camera1.java:257)
        at com.otaliastudios.cameraview.CameraController$3.run(CameraController.java:183)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.os.HandlerThread.run(HandlerThread.java:61)
     Caused by: java.lang.RuntimeException: Fail to connect to camera service
        at android.hardware.Camera.<init>(Camera.java:497)
        at android.hardware.Camera.open(Camera.java:342)
        at com.otaliastudios.cameraview.Camera1.createCamera(Camera1.java:215)
        at com.otaliastudios.cameraview.Camera1.onStart(Camera1.java:257) 
        at com.otaliastudios.cameraview.CameraController$3.run(CameraController.java:183) 
        at android.os.Handler.handleCallback(Handler.java:739) 
        at android.os.Handler.dispatchMessage(Handler.java:95) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.os.HandlerThread.run(HandlerThread.java:61) 

2) Video recording doesn't end automatically

Notes: The video compression engine keeps running long after ending monitor; could be the LG Nexus 4 & 5 CPUs to blame or a bad input variable on the size? Video file preview does appear in the log view (an improvement). The following repeats until the app is exited:

Applicable Logs:

02-07 10:22:07.175 3646-3755/org.havenapp.main D/skia: onFlyCompress
02-07 10:22:10.480 3646-3755/org.havenapp.main W/System.err: java.lang.IllegalStateException: The muxer track has finished muxing
02-07 10:22:10.480 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.common.Preconditions.checkState(Preconditions.java:441)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.containers.mp4.muxer.CodecMP4MuxerTrack.addFrameInternal(CodecMP4MuxerTrack.java:99)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.containers.mp4.muxer.MP4MuxerTrack.addFrame(MP4MuxerTrack.java:84)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.containers.mp4.muxer.CodecMP4MuxerTrack.addFrame(CodecMP4MuxerTrack.java:94)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.api.transcode.SinkImpl.outputVideoPacket(SinkImpl.java:71)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.api.transcode.SinkImpl.outputVideoFrame(SinkImpl.java:223)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.api.SequenceEncoder.encodeNativeFrame(SequenceEncoder.java:101)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.jcodec.api.android.AndroidSequenceEncoder.encodeImage(AndroidSequenceEncoder.java:50)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.havenapp.main.sensors.motion.CameraViewHolder.recordNewFrame(CameraViewHolder.java:295)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.havenapp.main.sensors.motion.CameraViewHolder.access$600(CameraViewHolder.java:57)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.havenapp.main.sensors.motion.CameraViewHolder$2.lambda$process$1(CameraViewHolder.java:236)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at org.havenapp.main.sensors.motion.-$$Lambda$CameraViewHolder$2$xWHMWmiHUtrxmxdrcSXPep4yUtA.run(lambda)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-07 10:22:10.481 3646-3755/org.havenapp.main W/System.err:     at java.lang.Thread.run(Thread.java:818)

@n8fr8
Copy link
Member Author

n8fr8 commented Feb 7, 2019

Thanks for the review and feedback. Yeah, still need to overall the way video works. I think we are going to switch to recording video in 30 second chunks as the default, and then just extracting preview frames as it is recording, to detect motion. If there is motion, then the current clip is saved, otherwise it is thrown out. we can also saved the matched frames as stills.

this will be on another dev branch / PR.

@n8fr8 n8fr8 merged commit 2be8c80 into master Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants