GNOME Bugzilla – Bug 790945
ahcsrc: problems with autofocus on Android
Last modified: 2018-01-26 10:13:39 UTC
Hey, Trying to use the Continuous video focus mode while filming with the ahcsrc element but I think there is a bug with it (and the other focus modes) as it is absolutely not focusing : GstElement* ahcsrc = gst_element_factory_make("ahcsrc", NULL); g_object_set(ahcsrc, GST_PHOTOGRAPHY_PROP_FOCUS_MODE, GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED, NULL); Also tried to call... gst_photography_set_autofocus((GstPhotography *) ahcsrc, FALSE); ...just before setting the focus mode but still it is not focusing Thanks
(In reply to test.code.010 from comment #0) > GstElement* ahcsrc = gst_element_factory_make("ahcsrc", NULL); > g_object_set(ahcsrc, GST_PHOTOGRAPHY_PROP_FOCUS_MODE, > GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_EXTENDED, NULL); > Do you know the GST_STATE of ahcsrc when you set the mode? If your codes do really like that, you are setting the mode in NULL state. The mode can be set only after opening camera device, then the state should be PUASED, or PLAYING.
Tried to set it in paused and playing state. Does not seem it works either. Maybe I am doing something wrong ? Would be nice if you could try it yourself :) Thanks for the help
If you've got any more idea ?
I have checked what happens when autofocus is enabled. Currently, autofocus callback is commented out so it crashes after enabling it. ;( However, even if the callback receives the result properly, my nexus 5 complains error from camera-sensor. ``` 12-13 13:19:13.166 9910 9910 D org.freedesktop.gstreamer.camera.GstAhc: AutoFocus: true 12-13 13:19:13.166 9910 9910 D GStreamer+camera-test: 0:00:24.174453085 0x71bcdd3000 /Users/justin/git/gst-ahc-example/app/src/main/jni/android_camera.c:435:gst_native_set_auto_focus Setting Autofocus (1) 12-13 13:19:13.528 2718 9961 E mm-camera-sensor: af_actuator_move_focus:240error 12-13 13:19:13.572 9910 9910 W GStreamer+ahcsrc: 0:00:24.579884532 0x71bcdd3000 gstahcsrc.c:1698:gst_ahc_src_on_auto_focus:<ahcsrc> Auto focus completed : 1 ``` I need to investigate more.
Created attachment 365471 [details] [review] ahc: enable autofocus callback It should be enabled to set autofocus properly, but it seems to be commented out mistakenly from the first commit.
(In reply to Justin J. Kim from comment #4) > I need to investigate more. Oh, I missed adding feature to manifest. With the manifest and the patch above, Autofocus works properly. (In reply to test.code.010 from comment #3) > If you've got any more idea ? Did you check the manifest? According to the API, it should have the below one. <uses-feature android:name="android.hardware.camera.autofocus" />
Should this patch be pushed then or is more work needed?
(In reply to Tim-Philipp Müller from comment #7) > Should this patch be pushed then or is more work needed? Yes, could you please merge it if there's no concern? It should be pushed because it causes a crash by missing callback if autofocus is enabled.
Done, thanks: commit 297f7e4f04d5e2539612e5d29c8ff8b51af16d6c (HEAD -> master) Author: Justin Kim <justin.kim@collabora.com> Date: Wed Dec 13 13:43:30 2017 +0900 ahc: enable autofocus callback It should be enabled to set autofocus properly, but it seems to be commented out mistakenly from the first commit. https://bugzilla.gnome.org/show_bug.cgi?id=790945