Closed Bug 978531 Opened 12 years ago Closed 12 years ago

[Camera][Madai][QRD] The preview is not available when reopening the camera

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
blocker

Tracking

(b2g-v1.4 verified, b2g-v2.0 verified)

VERIFIED FIXED
1.4 S5 (11apr)
Tracking Status
b2g-v1.4 --- verified
b2g-v2.0 --- verified

People

(Reporter: dmarcos, Assigned: dmarcos)

References

Details

(Whiteboard: [landed-on-master] [m+])

Attachments

(3 files, 1 obsolete file)

Attached video noPreview.MOV
Seen on a Nexus4 Steps to reproduce: 1. Open the camera 2. Exit the camera and go to the homescreen (by pressing home) 3. Repeat 1,2 multiple times. The preview is sometimes not available. See attached video (problem at second 30)
Blocks: 983405
Whiteboard: [branch-camera-new-features] [priority]
Still reproduces on: Gaia a4238bb23a83f89853a360d4ae04313c1010eba6 Gecko https://hg.mozilla.org/mozilla-central/rev/46041cc216fd BuildID 20140313040203 Version 30.0a1
The error callback is called on this.mozCamera.setConfiguration(options, success, error); The argument received on the callback is a string that says "FAILURE". No other information available
Flags: needinfo?(mhabicher)
Assignee: nobody → mhabicher
Would be interesting to know if this happens on other hardware and whether it is speed dependent. Does it only happen when switching quickly?
Attached file Logcat of the issue occuring (obsolete) —
GonkCameraControl doesn't have an instance of GonkCameraHardware. 03-18 17:56:44.601 881 2343 I Gecko : Pushing camera parameters 03-18 17:56:44.601 881 2343 I Gecko : virtual nsresult mozilla::nsGonkCameraControl::PushParametersImpl():868 : mCameraHw is null 03-18 17:56:44.601 881 2343 I Gecko : nsresult mozilla::nsGonkCameraControl::SetConfigurationInternal(const mozilla::ICameraControl::Configuration&):219 03-18 17:56:44.601 881 2343 I Gecko : virtual nsresult mozilla::nsGonkCameraControl::StopPreviewImpl():538 : mCameraHw is null 03-18 17:56:44.601 881 2343 I Gecko : Camera control API failed at 8 with 0x80040111 03-18 17:56:44.611 881 881 I Gecko : DOM OnHardwareStateChange(1) 03-18 17:56:44.621 881 881 I Gecko : DOM OnError context=11, error='ErrorSetThumbnailSizeFailed' 03-18 17:56:44.621 881 881 I Gecko : DOM OnError context=8, error='FAILURE' 03-18 17:56:44.641 881 881 E GeckoConsole: Content JS LOG at app://camera.gaiamobile.org/js/main.js:3750 in Camera.prototype.configure/error: Error configuring camera
Flags: needinfo?(mhabicher)
A log with more trace statements. Here is the sequence of CameraControl API calls (and callbacks): 18:26:55 ➜ bug978531 grep -rn "mozilla::nsDOMCameraControl::" log02.txt 14:03-18 18:22:04.669 2808 2808 I Gecko : mozilla::nsDOMCameraControl::nsDOMCameraControl(uint32_t, const mozilla::dom::CameraConfiguration&, mozilla::dom::GetCameraCallback*, mozilla::dom::CameraErrorCallback*, nsPIDOMWindow*):160 : this=0xb2bdfda0 34:03-18 18:22:04.849 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnHardwareStateChange(mozilla::CameraControlListener::HardwareState):1062 : this=0xb2bdfda0 36:03-18 18:22:04.849 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnPreviewStateChange(mozilla::CameraControlListener::PreviewState):1116 : this=0xb2bdfda0 73:03-18 18:22:05.020 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnConfigurationChange(mozilla::nsDOMCameraControl::DOMCameraConfiguration*):1205 : this=0xb2bdfda0 80:03-18 18:22:05.020 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnHardwareStateChange(mozilla::CameraControlListener::HardwareState):1062 : this=0xb2bdfda0 83:03-18 18:22:05.030 2808 2808 I Gecko : already_AddRefed<mozilla::dom::CameraCapabilities> mozilla::nsDOMCameraControl::Capabilities():738 : this=0xb2bdfda0 224:03-18 18:22:05.070 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetOnShutter(mozilla::dom::CameraShutterCallback*):666 : this=0xb2bdfda0 225:03-18 18:22:05.070 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetOnRecorderStateChange(mozilla::dom::CameraRecorderStateChange*):692 : this=0xb2bdfda0 270:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetWhiteBalanceMode(const nsAString_internal&, mozilla::ErrorResult&):373 : this=0xb2bdfda0 272:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetFlashMode(const nsAString_internal&, mozilla::ErrorResult&):403 : this=0xb2bdfda0 274:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetIsoMode(const nsAString_internal&, mozilla::ErrorResult&):433 : this=0xb2bdfda0 276:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetSceneMode(const nsAString_internal&, mozilla::ErrorResult&):388 : this=0xb2bdfda0 278:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetPictureSize(JSContext*, JS::Handle<JS::Value>, mozilla::ErrorResult&):533 : this=0xb2bdfda0 280:03-18 18:22:05.130 2808 2808 I Gecko : JS::Value mozilla::nsDOMCameraControl::GetPictureSize(JSContext*, mozilla::ErrorResult&):518 : this=0xb2bdfda0 281:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetThumbnailSize(JSContext*, JS::Handle<JS::Value>, mozilla::ErrorResult&):563 : this=0xb2bdfda0 283:03-18 18:22:05.130 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetConfiguration(const mozilla::dom::CameraConfiguration&, const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraSetConfigurationCallback> >&, const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraErrorCallback> >&, mozilla::ErrorResult&):859 : this=0xb2bdfda0 298:03-18 18:22:05.410 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnPreviewStateChange(mozilla::CameraControlListener::PreviewState):1116 : this=0xb2bdfda0 350:03-18 18:22:05.780 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnPreviewStateChange(mozilla::CameraControlListener::PreviewState):1116 : this=0xb2bdfda0 356:03-18 18:22:05.840 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnConfigurationChange(mozilla::nsDOMCameraControl::DOMCameraConfiguration*):1205 : this=0xb2bdfda0 465:03-18 18:22:06.001 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnPreviewStateChange(mozilla::CameraControlListener::PreviewState):1116 : this=0xb2bdfda0 1004:03-18 18:22:08.223 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::ReleaseHardware(const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraReleaseCallback> >&, const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraErrorCallback> >&, mozilla::ErrorResult&):998 : this=0xb2bdfda0 1063:03-18 18:22:08.253 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnPreviewStateChange(mozilla::CameraControlListener::PreviewState):1116 : this=0xb2bdfda0 1111:03-18 18:22:08.353 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetOnShutter(mozilla::dom::CameraShutterCallback*):666 : this=0xb2bdfda0 1112:03-18 18:22:08.353 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetOnRecorderStateChange(mozilla::dom::CameraRecorderStateChange*):692 : this=0xb2bdfda0 1113:03-18 18:22:08.363 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetWhiteBalanceMode(const nsAString_internal&, mozilla::ErrorResult&):373 : this=0xb2bdfda0 1117:03-18 18:22:08.363 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetFlashMode(const nsAString_internal&, mozilla::ErrorResult&):403 : this=0xb2bdfda0 1121:03-18 18:22:08.363 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetIsoMode(const nsAString_internal&, mozilla::ErrorResult&):433 : this=0xb2bdfda0 1125:03-18 18:22:08.363 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetSceneMode(const nsAString_internal&, mozilla::ErrorResult&):388 : this=0xb2bdfda0 1129:03-18 18:22:08.363 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetPictureSize(JSContext*, JS::Handle<JS::Value>, mozilla::ErrorResult&):533 : this=0xb2bdfda0 1132:03-18 18:22:08.373 2808 2808 I Gecko : JS::Value mozilla::nsDOMCameraControl::GetPictureSize(JSContext*, mozilla::ErrorResult&):518 : this=0xb2bdfda0 1133:03-18 18:22:08.373 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetThumbnailSize(JSContext*, JS::Handle<JS::Value>, mozilla::ErrorResult&):563 : this=0xb2bdfda0 1139:03-18 18:22:08.373 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::SetConfiguration(const mozilla::dom::CameraConfiguration&, const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraSetConfigurationCallback> >&, const mozilla::dom::Optional<mozilla::dom::OwningNonNull<mozilla::dom::CameraErrorCallback> >&, mozilla::ErrorResult&):859 : this=0xb2bdfda0 1151:03-18 18:22:08.373 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnHardwareStateChange(mozilla::CameraControlListener::HardwareState):1062 : this=0xb2bdfda0 1153:03-18 18:22:08.373 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnError(mozilla::CameraControlListener::CameraErrorContext, const nsAString_internal&):1308 : this=0xb2bdfda0 1155:03-18 18:22:08.373 2808 2808 I Gecko : void mozilla::nsDOMCameraControl::OnError(mozilla::CameraControlListener::CameraErrorContext, const nsAString_internal&):1308 : this=0xb2bdfda0
Attachment #8393154 - Attachment is obsolete: true
Easier to read version of comment 5 (file numbers from log file in square brackets): - [14] getCamera() (invokes nsDOMCameraControl constructor) - [34] callback onHardwareStateChange - [36] callback onPreviewStateChange - [73] callback onConfigurationChange --> picture mode, preview 1280x720 - [80] callback onHardwareStateChange --> hardware open - [80] get camera capabilities - [224] set onShutter - [225] set onRecorderStateChange - [270] set whiteBalanceMode - [272] set flashMode - [274] set isoMode - [276] set sceneMode - [278] set pictureSize - [280] get pictureSize - [281] set thumbnailSize - [283] setConfiguration() - [296] --- preview started --- - [298] callback onPreviewStateChange --> started - [346] --- preview paused --- - [350] callback onPreviewStateChange --> paused - [356] callback onConfigurationChange --> picture mode, preview 640x480 ...this is in response to setConfiguration() [283] - [464] --- preview started --- - [465] callback onPreviewStateChange --> started - [1004] release() - [1015] --- preview stopped --- - [1063] callback onPreviewStateChange --> stopped - [1063] set onShutter ...not sure why this or any other setter is being called here - [1112] set onRecorderStateChange - [1113] set whiteBalanceMode - [1117] set flashMode - [1121] set isoMode - [1125] set sceneMode - [1129] set pictureSize - [1132] get pictureSize - [1133] set thumbnailSize - [1139] setConfiguration() - [1151] callback onHardwareStateChange --> closed ...this is in response to release() [1004] - [1153] OnError : "ErrorSetThumbnailSizeFailed" - [1155] OnError : "FAILURE" ...this is in response to setConfiguration[1139] So the "FAILURE" is because setConfiguration() is being called on a CameraControl object that has released its underlying hardware and is now defunct. Looks like a race condition in the Camera app. The lack of a call to the nsDOMCameraControl constructor after release() is a clue that something has gone wrong here. I obtained these results on a nexus-4 running: - gecko: larch:328c2ee3ca75 - gaia: camera-new-features:092ced82a7c50841e7ef3c273700fc0efbd1e97d
Over to you guys.
Assignee: mhabicher → nobody
Flags: needinfo?(wilsonpage)
Flags: needinfo?(jdarcangelo)
Assignee: nobody → dmarcos
Severity: normal → blocker
Investigating this. Taking things out justin and wilsons plate.
Flags: needinfo?(wilsonpage)
Flags: needinfo?(jdarcangelo)
Whiteboard: [branch-camera-new-features] [priority] → [branch-camera-new-features] [priority] eta for fix 3/20
Sound like a setting may be being altered which could have a `change:` callback firing that is trying to reconfigure the camera. I'm guessing this could easily be fixed by checking if mozCamera is attached or released before trying to configure it is any way. Although, we are setting `this.mozCamera = null` after releasing, so not sure how we could still have an interface around to use...?
We don't any visibility over the life cycle of the nsDOMCameraControl object. We don't know where the nsDOMCameraControl constructor is called. I found what the issue but haven't found a solution yet. After clicking the home button the camera app calls release the current nsDOMCameraControl (The release call is asynchronous) When the camera is reopened we call mozCameras.getCamera to request a new nsDOMCameraControl. If the app is reopened quickly sometimes the previous release call hasn't finished and mozCameras.getCamera executes first. Then the release call is executed and we call setConfiguration over nsDOMCameraControl that has been released. Apparently the release call deallocates/removes all the requested nsDOMCameraControls ant not only the one that the message/method was called on.
Flags: needinfo?(mhabicher)
Attachment #8394485 - Flags: review?(wilsonpage)
Comment on attachment 8394485 [details] [review] Pull Request on camera-new-features From Gecko-land, this looks good to me. I wonder if it's worth balling this logic into Gecko at some point, to save other camera apps the trouble.
Attachment #8394485 - Flags: feedback+
Flags: needinfo?(mhabicher)
Whiteboard: [branch-camera-new-features] [priority] eta for fix 3/20 → [branch-camera-new-features in-code-review]
Attachment #8394485 - Flags: review?(wilsonpage) → review?(dflanagan)
Attachment #8394485 - Flags: review?(dflanagan) → review?(jdarcangelo)
Attachment #8394485 - Flags: review?(jdarcangelo) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Modification to the STR reproduces the same problem per Sameer from QC: · Open the gallery and press on the camera icon. · Hit home button. · Repeat “a” and “b” couple of times, we see the black screen. Please test
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Whiteboard: [branch-camera-new-features in-code-review] → [branch-camera-new-features in-code-review] [m+]
This doesn't reproduce anymore. What device are they using, what version of gecko/gaia?
Flags: needinfo?(hkoka)
This is on QRD device (see STR from Qualcomm) -- we need to get the 2 QRDs up (having some issues at the moment) before we can reproduce and investigate this one
Flags: needinfo?(hkoka)
Summary: [Camera][Madai] The preview is not available when reopening the camera → [Camera][Madai][QRD] The preview is not available when reopening the camera
Whiteboard: [branch-camera-new-features in-code-review] [m+] → [landed-on-master] [m+]
The STR in comment 15 are different than the original ones for this bug. Since it involves an activity, it is probably a dupe of the activity bug that Justin just fixed.
Please test with the build that has this bug fix in 988610
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
Bulk edit for camera bugs. If earlier comments do not show how this bug landed to master, it probably landed as part of https://github.com/mozilla-b2g/gaia/pull/17599 which merged the camera-new-features branch into master. This bug was uplifted from master to v1.4 as part of https://github.com/mozilla-b2g/gaia/commit/a8190d08e61316a86bba572ba8d894d081a20530
Target Milestone: --- → 1.4 S5 (11apr)
The bug is no longer reproduces on 1.4 and master No black screen appears when trying to render the preview, preview appears each time 1.4 Environmental Variables: Device: Buri 1.4 MOZ BuildID: 20140407000203 Gaia: 86de7fcce674ef6196d68e7e23552d219a3d72db Gecko: 6e028297be14 Version: 30.0a2 Firmware Version: v1.2-device.cfg 1.5 Environmental Variables: Device: Buri 1.5 MOZ BuildID: 20140407040202 Gaia: f1a98bfaa3ab2480945bd7018831fd56c61cdc24 Gecko: 5405d6f4e3c6 Version: 31.0a1 Firmware Version: v1.2-device.cfg
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: