Closed Bug 977494 Opened 10 years ago Closed 10 years ago

[Camera] We need onFocusChanged callback

Categories

(Firefox OS Graveyard :: Gaia::Camera, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
1.4 S3 (14mar)

People

(Reporter: dmarcos, Assigned: youngwoo.jo)

Details

Attachments

(1 file)

There are three focus states for the camera API: none, focusing and focused. If we call setAutoFocus on the focusing state we are getting gecko crashes. We also observed that after calling autoFocus it takes some time for the API to transition from none to focusing after calling setAutoFocus. If we call setAutofocus during this time span gecko crashes as well. The focus state is not accurate on representing the internal state of the camera.

We're implementing tap to focus and we need to know a reliable way on when the camera can handle a setAutoFocus call without crashing.
OS: Mac OS X → Gonk (Firefox OS)
Hardware: x86 → PowerPC
If a user touches on the preview multiple times and quickly for a while, and then a user touches the button to take a picture, the camera app becomes crashed.

Whenever a user touches on the preview, the camera app calls autoFocus(). In this case, the second call to autoFocus() will cancel the first autoFocus(), because the time between the calls to autoFocus is very short. And also, the error callback of the previous call should be called.
However, the error callback can be null, because it's optionally provided by an app.
So we have to check if it's null, however the below code does not check it and always calls the method, even if the callback is null.
http://lxr.mozilla.org/mozilla-central/source/dom/camera/DOMCameraControl.cpp#832
This is a very simple patch to modify the crash.
Checking null is added.
Comment on attachment 8388047 [details] [diff] [review]
fix_crash_for_multiple_autofocuses.patch

Review of attachment 8388047 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for catching that.
Attachment #8388047 - Flags: review+
Hardware: PowerPC → ARM
https://hg.mozilla.org/integration/b2g-inbound/rev/cb70becb6bf8

Thanks for the patch! One request, please make sure that you have Mercurial configured to generate patches with commit information in the future. Makes life easier for those landing on your behalf :)
https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F
Assignee: nobody → hiro7998
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/cb70becb6bf8
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S3 (14mar)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: