It's not possible to take a picture on a Galaxy S2 i9100. logcat shows:
D/exynos_camera( 1869): exynos_camera_get_parameters(0x40034260)
D/exynos_camera( 1869): exynos_camera_put_parameters(0x40034260)
D/exynos_camera( 1869): exynos_camera_enable_msg_type(0x40034260, 16)
D/exynos_camera( 1869): exynos_camera_disable_msg_type(0x40034260, 16)
D/exynos_camera( 1869): exynos_camera_get_camera_info(0, 0x415eebc0)
D/exynos_camera( 1869): Selected camera: M5MO
D/exynos_camera( 1869): exynos_camera_get_parameters(0x40034260)
D/exynos_camera( 1869): exynos_camera_put_parameters(0x40034260)
D/exynos_camera( 1869): exynos_camera_get_camera_info(0, 0x43544bc0)
D/exynos_camera( 1869): Selected camera: M5MO
W/CameraView( 6712): previewSize: 800x480
W/CameraView( 6712): data bytes: 1382400
D/exynos_camera( 1869): exynos_camera_get_parameters(0x40034260)
D/exynos_camera( 1869): exynos_camera_put_parameters(0x40034260)
W/CameraView( 6712): previewFormat: 17
W/CameraView( 6712): croppingRect: Rect(0, 215 - 480, 585)
W/CameraView( 6712): rotation: 90
W/CameraView( 6712): java.io.IOException: provided width and height don't jive with the data length
W/CameraView( 6712): at org.thoughtcrime.securesms.util.BitmapUtil.rotateNV21(BitmapUtil.java:195)
W/CameraView( 6712): at org.thoughtcrime.securesms.util.BitmapUtil.createFromNV21(BitmapUtil.java:164)
W/CameraView( 6712): at org.thoughtcrime.securesms.components.camera.CameraView$CaptureTask.doInBackground(CameraView.java:561)
W/CameraView( 6712): at org.thoughtcrime.securesms.components.camera.CameraView$CaptureTask.doInBackground(CameraView.java:546)
W/CameraView( 6712): at android.os.AsyncTask$2.call(AsyncTask.java:292)
W/CameraView( 6712): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/CameraView( 6712): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/CameraView( 6712): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/CameraView( 6712): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/CameraView( 6712): at java.lang.Thread.run(Thread.java:818)
This is related to #4637, also a Samsung Galaxy S2 related Camera problem. BTW the front camera works for me.
Yes, the front camera works for me too.
Also related to #3752
@jochenberger could you please build and run the 3.9.0 branch and post a debug log?
java.io.IOException: provided width and height don't jive with the data length (1382400). Width: 800 height: 480 = data length: 576000
This seems to happen on the Galaxy S2 on CM only, so maybe @Lysergic-Acid has a clue.
I may have a clue on this, but I'm not even sure what this project is about lol
@Lysergic-Acid it's a secure messaging application for Android. There's an option to take pictures with the phone's camera. This doesn't work with the i9100 on CM (12.1 in my case). Apparently, the data cannot be decoded because the number of bytes that is returned from the system does not match the expected number of bytes (hence the error message). The expected number is 576000 but the actual number is 1382400. This happens for previewFormat: 17, though I'm not sure what that means. ;-)
This is so weird. The camera HAL has a function to gather the byte amount sent to the system, before it was a fixed value always bigger than necessary lol I gotta check what case the "previewFormat 17 is choosen and why only this app has issues with it
CM13 (alpha 6) provides some more information:
02-04 10:10:16.315 1934 2302 D exynos_camera: Selected camera: M5MO
02-04 10:10:16.322 1934 1934 D exynos_camera: exynos_camera_set_parameters(0x415ee528, effect=none;effect-values=none,mono,negative,sepia,aqua;exposure-compensation=0;exposure-compensation-step=0.5;flash-mode=off;flash-mode-values=off,auto,on,torch;focal-length=4.03;focus-areas=(0,0,0,0,0);focus-distances=0.15,1.20,Infinity;focus-mode=continuous-video;focus-mode-values=auto,infinity,macro,fixed,facedetect,continuous-video;full-video-snap-supported=false;horizontal-view-angle=60.5;iso=auto;iso-values=auto,ISO50,ISO100,ISO200,ISO400,ISO800;jpeg-quality=90;jpeg-thumbnail-height=240;jpeg-thumbnail-quality=100;jpeg-thumbnail-size-values=320x240,400x240,0x0;jpeg-thumbnail-width=320;max-exposure-compensation=4;max-num-focus-areas=1;max-zoom=30;min-exposure-compensation=-4;picture-format=jpeg;picture-format-values=jpeg;picture-size=3264x2448;picture-size-values=3264x2448,3264x1968,2048x1536,2048x1232,1280x960,800x480,640x480;preferred-preview-size-for-video=800x450;preview-format=yuv420sp;preview-format-values=yuv420sp,yuv420p,rgb565;preview-fps-range=7000,3000
02-04 10:10:16.339 1934 1934 D exynos_camera: exynos_camera_params_apply: Preview size: 1280x720, picture size: 3264x2448, recording size: 1280x720
02-04 10:10:16.342 26164 26164 W CameraView: onResume() completed
02-04 10:10:16.346 1934 2302 D exynos_camera: exynos_camera_preview_enabled(0x415ee528)
02-04 10:10:16.348 26164 26178 W CameraUtils: getPreferredPreviewSize(90, 480, 764) -> target 764x480, AR 1,59
02-04 10:10:16.348 26164 26178 W CameraUtils: 1280x720 (1,78)
02-04 10:10:16.348 26164 26178 W CameraUtils: (good size, suboptimal ratio)
02-04 10:10:16.348 26164 26178 W CameraUtils: 640x480 (1,33)
02-04 10:10:16.349 26164 26178 W CameraUtils: 720x480 (1,50)
02-04 10:10:16.349 26164 26178 W CameraUtils: 800x480 (1,67)
02-04 10:10:16.349 26164 26178 W CameraUtils: (good size, suboptimal ratio)
02-04 10:10:16.349 26164 26178 W CameraUtils: 800x450 (1,78)
02-04 10:10:16.349 26164 26178 W CameraUtils: 352x288 (1,22)
02-04 10:10:16.349 26164 26178 W CameraUtils: 320x240 (1,33)
02-04 10:10:16.349 26164 26178 W CameraUtils: 176x144 (1,22)
02-04 10:10:16.350 26164 26178 W CameraView: starting preview with size 800x480
02-04 10:10:16.351 1934 2857 D exynos_camera: exynos_camera_set_parameters(0x415ee528, effect=none;effect-values=none,mono,negative,sepia,aqua;exposure-compensation=0;exposure-compensation-step=0.5;flash-mode=off;flash-mode-values=off,auto,on,torch;focal-length=4.03;focus-areas=(0,0,0,0,0);focus-distances=0.15,1.20,Infinity;focus-mode=continuous-video;focus-mode-values=auto,infinity,macro,fixed,facedetect,continuous-video;full-video-snap-supported=false;horizontal-view-angle=60.5;iso=auto;iso-values=auto,ISO50,ISO100,ISO200,ISO400,ISO800;jpeg-quality=90;jpeg-thumbnail-height=240;jpeg-thumbnail-quality=100;jpeg-thumbnail-size-values=320x240,400x240,0x0;jpeg-thumbnail-width=320;max-exposure-compensation=4;max-num-focus-areas=1;max-zoom=30;min-exposure-compensation=-4;picture-format=jpeg;picture-format-values=jpeg;picture-size=3264x2448;picture-size-values=3264x2448,3264x1968,2048x1536,2048x1232,1280x960,800x480,640x480;preferred-preview-size-for-video=800x450;preview-format=yuv420sp;preview-format-values=yuv420sp,yuv420p,rgb565;preview-fps-range=7000,3000
02-04 10:10:16.351 1934 2857 D exynos_camera: exynos_camera_params_apply: Preview size: 1280x720, picture size: 3264x2448, recording size: 1280x720
02-04 10:10:16.352 1934 1934 D exynos_camera: exynos_camera_preview_enabled(0x415ee528)
02-04 10:10:16.352 1934 1934 D exynos_camera: exynos_camera_set_preview_window(0x415ee528, 0x418139f8)
02-04 10:10:16.352 1934 1934 E exynos_camera: exynos_camera_set_preview_window: Invalid preview buffers count
02-04 10:10:16.353 1934 1934 D exynos_camera: exynos_camera_start_preview(0x415ee528)
02-04 10:10:16.360 1934 1934 E exynos_v4l2: exynos_v4l2_reqbufs: ioctl failed
02-04 10:10:16.367 1934 1934 E exynos_v4l2: exynos_v4l2_reqbufs: ioctl failed
02-04 10:10:16.374 1934 1934 E exynos_v4l2: exynos_v4l2_reqbufs: ioctl failed
02-04 10:10:16.381 1934 1934 E exynos_v4l2: exynos_v4l2_reqbufs: ioctl failed
02-04 10:10:16.389 1934 1934 E exynos_v4l2: exynos_v4l2_reqbufs: ioctl failed
02-04 10:10:16.389 1934 1934 D exynos_camera: Found 3 preview buffers available!
The Invalid preview buffers count part looks interesting.
Probably related to https://jira.cyanogenmod.org/browse/CYAN-6320 and https://jira.cyanogenmod.org/browse/CYAN-7358
@Lysergic-Acid does that help you?
Log when taking a picture with the front camera (works fine):
02-19 12:29:46.541 1934 1934 D exynos_camera: exynos_camera_get_parameters(0x41002130)
02-19 12:29:46.541 1934 1934 D exynos_camera: exynos_camera_put_parameters(0x41002130)
02-19 12:29:46.543 1934 3437 D exynos_camera: exynos_camera_enable_msg_type(0x41002130, 16)
02-19 12:29:46.550 1934 10317 D exynos_camera: exynos_camera_disable_msg_type(0x41002130, 16)
02-19 12:29:46.576 1934 2299 D exynos_camera: exynos_camera_get_camera_info(1, 0x42fa671c)
02-19 12:29:46.576 1934 2299 D exynos_camera: Selected camera: S5K5BAFX
02-19 12:29:46.580 1934 3438 D exynos_camera: exynos_camera_get_parameters(0x41002130)
02-19 12:29:46.580 1934 3438 D exynos_camera: exynos_camera_put_parameters(0x41002130)
02-19 12:29:46.581 1934 3437 D exynos_camera: exynos_camera_get_camera_info(1, 0x430a571c)
02-19 12:29:46.581 1934 3437 D exynos_camera: Selected camera: S5K5BAFX
02-19 12:29:46.583 6557 6557 W CameraView: previewSize: 640x480
02-19 12:29:46.583 6557 6557 W CameraView: data bytes: 460800
02-19 12:29:46.583 1934 2299 D exynos_camera: exynos_camera_get_parameters(0x41002130)
02-19 12:29:46.583 1934 2299 D exynos_camera: exynos_camera_put_parameters(0x41002130)
02-19 12:29:46.584 6557 6557 W CameraView: previewFormat: 17
02-19 12:29:46.584 6557 6557 W CameraView: croppingRect: Rect(0, 135 - 480, 504)
02-19 12:29:46.584 6557 6557 W CameraView: rotation: 270
02-19 12:29:46.660 6557 6583 D skia : onFlyCompress
02-19 12:29:46.743 6557 10321 W PersistentBlobProvider: Starting stream copy....
02-19 12:29:46.765 6557 10321 W PersistentBlobProvider: Stream copy finished...
02-19 12:29:46.924 6557 6594 W AttachmentManager: slide with size 21753 took 145ms
02-19 12:29:46.954 6557 6557 W ThumbnailView: loading part with id content://org.thoughtcrime.securesms/capture/1455881386720/1455881386715, progress 1
02-19 12:29:47.152 6557 6567 I art : Background partial concurrent mark sweep GC freed 21075(1446KB) AllocSpace objects, 7(2MB) LOS objects, 23% free, 13MB/17MB, paused 4.694ms total 196.678ms
02-19 12:29:47.218 6557 6557 W CameraView: onPause() queued
02-19 12:29:47.236 1934 3437 D exynos_camera: exynos_camera_disable_msg_type(0x41002130, 16)
02-19 12:29:47.236 1934 2299 D exynos_camera: exynos_camera_disable_msg_type(0x41002130, 16)
02-19 12:29:47.236 1934 3438 D exynos_camera: exynos_camera_disable_msg_type(0x41002130, 65535)
02-19 12:29:47.236 1934 3438 D exynos_camera: exynos_camera_stop_preview(0x41002130)
02-19 12:29:47.266 1934 10317 E exynos_camera: exynos_camera_preview_thread: Exiting thread
02-19 12:29:47.286 1934 3438 D exynos_camera: exynos_camera_cancel_picture(0x41002130)
02-19 12:29:47.286 1934 3438 E exynos_camera: Picture was already stopped!
02-19 12:29:47.286 1934 3438 D exynos_camera: exynos_camera_release(0x41002130)
02-19 12:29:47.304 1934 3438 D exynos_camera: exynos_camera_set_preview_window(0x41002130, 0x0)
02-19 12:29:47.304 1934 3438 I CameraFlashlight: Destroying camera 1
02-19 12:29:47.304 1934 3438 D exynos_camera: exynos_camera_close(0x41002130)
02-19 12:29:47.305 1934 3438 D exynos_camera: exynos_camera_get_number_of_cameras()
02-19 12:29:47.305 1934 3438 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=1
02-19 12:29:47.306 1934 3438 I CameraService: disconnect: Disconnected client for camera 1 for PID 6557
02-19 12:29:47.306 6557 6572 W CameraView: released old camera instance
02-19 12:29:47.324 6557 6557 W CameraView: onPause() completed
I think your problem is the "Recording-hint". It is possibly specified with "true" in the camera-parameters. (Be aware that the logcat truncates your debugline of exynos_camera_params_apply). According to your logcat I see the focus-mode is set to continuous-video, so Recording-hint is true. When Recording-hint is true, your specifed "preview-size"-parameter is kind of ignored. A routine is executed which determines the best size with the same aspect ratio. I'm not sure it actually works....: https://github.com/CyanogenMod/android_device_samsung_galaxys2-common/blob/cm-13.0/camera/exynos_camera.c#L680
Your preview-size setting 800x480 resolves to 1280x720 => x 1.5 = 1382400 bytes and is stored in a parameter in the HAL, and is applied when set_preview_windows is called. https://github.com/CyanogenMod/android_device_samsung_galaxys2-common/blob/cm-13.0/camera/exynos_camera.c#L2324
To bypass the routine, you need to set the "Recording-hint" to "false". It will result in lower preview-fps because the camera is set in 'picture-mode'. When you set your preview-size to 800x480 it will actually use this resolution.
@rINanDO Thanks for the explanation. I wonder why it seems to work with all other kinds of devices though.
Seems that the latest CM13 release fixes this problem - rear camera is working for me :smiley:
@lukeIam I can confirm this. The nightly from August 18th works for me.
Hi,
any news?
GitHub Issue Cleanup:
See #7598 for more information.
Most helpful comment
Seems that the latest CM13 release fixes this problem - rear camera is working for me :smiley: