Closed Bug 1099381 Opened 11 years ago Closed 10 years ago

[Camera][Gecko] If pre-init camera SetConfiguration() fails, need to release CameraControl and call onClosed

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.2 S1 (5dec)

People

(Reporter: mikeh, Assigned: mikeh)

References

Details

(Whiteboard: [ft:media] [2.2 target])

Attachments

(1 file, 2 obsolete files)

With the camera pre-initialization in bug 1090501, calling getCamera() now instead creates a DOMCameraControl wrapper around the ICameraControl object and if an initial configuration is specified, passes that configuration to SetConfiguration(). SetConfiguration() can fail (see bug 1099375), but there is no way to communicate that to the app. The cleanest solution seems to be to call getCamera()s onError callback and reject the promise, while discarding the DOM/ICameraControl objects.
...unfortunately the getCamera() callbacks have already run. So have the hardware state change notification. Also, in the case of bug 1099375, we were even able to successfully apply the requested configuration! The failure doesn't occur until GCC::SetConfigurationImpl() tries to start the preview. It's this last step that fails.
I'm not entirely happy with this solution, but wanted to solicit some feedback.
Assignee: nobody → mhabicher
Status: NEW → ASSIGNED
Attachment #8525386 - Flags: feedback?(aosmond)
Comment on attachment 8525386 [details] [diff] [review] WIP - close camera if initial config can't be applied to pre-init camera Review of attachment 8525386 [details] [diff] [review]: ----------------------------------------------------------------- Looks fine to me, although if you want a cleaner solution, why not redefine how/when we fulfill getCamera instead. Something like: - Never fulfill getCamera promise on hardware open. Instead fulfill on configuration updated. - Add configuration updated trigger when camera opened without being supplied an initial configuration by application. This makes some kind of logical sense because it still has an initial state as given by the driver.
Attachment #8525386 - Flags: feedback?(aosmond) → feedback+
(In reply to Andrew Osmond [:aosmond] from comment #3) > Looks fine to me, although if you want a cleaner solution, why not redefine > how/when we fulfill getCamera instead. Something like: > - Never fulfill getCamera promise on hardware open. Instead fulfill on > configuration updated. > - Add configuration updated trigger when camera opened without being > supplied an initial configuration by application. This makes some kind of > logical sense because it still has an initial state as given by the driver. The reason for not doing this is that in general, this -will- succeed, and it allows the Camera app to start up faster if it gets the open hardware instance ASAP. i.e. it can grab recorder profiles, query additional supported features, etc.
Summary: [Camera][Gecko] If pre-init camera SetConfiguration() fails, need to release CameraControl and call onError → [Camera][Gecko] If pre-init camera SetConfiguration() fails, need to release CameraControl and call onClosed
Whiteboard: [ft:media] [2.2 target]
Target Milestone: --- → 2.2 S1 (5dec)
Small change in StartInternal(): if there's no initial config, we don't call OnConfigurationChange() or OnPreviewStateChange().
Attachment #8528557 - Attachment is obsolete: true
Attachment #8528557 - Flags: review?(aosmond)
Attachment #8528609 - Flags: review?(aosmond)
Comment on attachment 8528609 [details] [diff] [review] Close camera if initial config can't be applied to pre-init camera, v1.1 Review of attachment 8528609 [details] [diff] [review]: ----------------------------------------------------------------- LGTM.
Attachment #8528609 - Flags: review?(aosmond) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: