Closed Bug 983705 Opened 7 years ago Closed 7 years ago

[Camera][Madai][Buri] Camera Preview is not working on Qualcomm QRD device due to preview size anomalies


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

Gonk (Firefox OS)
Not set


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

1.4 S5 (11apr)
Tracking Status
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed


(Reporter: hkoka, Assigned: justindarc)



(Whiteboard: [branch-camera-new-features] [priority])


(1 file)

Info from Qualcomm Testing on Camera-New-Features Branch:

Camera preview isn’t working on the QRD due to the preview size that the camera app is requesting during still capture mode:
* master branch (works): 352x228 
* camera-new-features branch (doesn’t work): 576x432

The selectOptimalPreviewSize() function in apps/camera/js/lib/camera-utils.js has seen significant change between the two branches and that’s where the preview size selection difference is coming from between the two Gaia branches.

In theory both preview sizes are being reported up from our Camera HAL, so I’m not convinced yet that this is a Gaia issue.   The larger preview size is desirable anyway, and AFAICT the Camera HAL is reporting 576x432 as a valid preview size to the framework, even though it later rejects that size at

Diego, can you please take a look at this in more detail during Friday SD time.   It’s pretty important that we get to the bottom of this issue quickly, to enable these camera features to land ASAP.
No longer depends on: 982900
Assignee: nobody → jdarcangelo
Flags: needinfo?(dflanagan)
Assignee: jdarcangelo → dwilson
dwilson: if you need us to workaround this issue in gaia, let us know what the 'deviceinfo.hardware' setting returns on your device.  That's the string that appears under "Model" in  Settings->Device Information
Flags: needinfo?(dflanagan)
Looks like this branch has the same issue as bug 969761. The camera app is not using the real screen resolution when calculating the preview size. This is solved by multiplying window.innerWidth by window.devicePixelRatio here:

When I do this I can see the preview and take snapshots. Although the preview position looks a bit off.

There's probably still a bug in the camera driver for 576x432.

@djf does the gaia camera change above sound reasonable to you?
Flags: needinfo?(dflanagan)
dwilson: we keep changing this code, and I can't remember if there is any reason why we're not using devicePixelRatio here.  This function is a recent chagne and I think I should have caught that on code review but did not.  Setting needinfo for Justin to confirm.
Flags: needinfo?(dflanagan) → needinfo?(jdarcangelo)
Well, the best explanation for this I know of comes from you
Assignee: dwilson → jdarcangelo
Flags: needinfo?(jdarcangelo)
Attachment #8391506 - Flags: review?(dflanagan)
Comment on attachment 8391506 [details] [review]
pull-request (camera-new-features)

r+ if you add documentation making it explicit that the viewportSize argument is expected to be in device pixels. This is an unusual enough design choice that it needs to be called out.
Attachment #8391506 - Flags: review?(dflanagan) → review+
Landed on camera-new-features:
Closed: 7 years ago
Resolution: --- → FIXED
Hi Justin
My QRD still has no preview in camera, or do I need specific gecko version?
Eric: There is no preview at all? Or the preview is not using the correct size?
Flags: needinfo?(echang)
Eric: If possible, can you debug the Camera in App Manager and run the following in the JS console and report the results here:




The first line will give you the list of previewSizes being returned from the QRD camera, the second line will give you the previewSize that's being used. This will help us out a great deal in determining the issue.

Also, while you're at it, if you could get me the devicePixelRatio of the QRD, that would be a tremendous helps as well:


There is no preview at all, like a black wallpaper with icons on it. I got this.mozCamera is null from these 2 preview size commands so I think there should be something wrong with my gecko. 

window.devicePixelRatio = 2
Flags: needinfo?(echang)
Ok, yeah, if mozCamera is null, the problem is more than just the previewSize selection, I think. Try flashing latest Gecko if you can and try again. If you get your Gecko working, it would be beneficial if you could post those previewSize values here so I can add them to the test data for our unit tests. Thanks for trying this out!
Bulk edit for camera bugs.

If earlier comments do not show how this bug landed to master, it probably landed as part of which merged the camera-new-features branch into master.

This bug was uplifted from master to v1.4 as part of
Target Milestone: --- → 1.4 S5 (11apr)
You need to log in before you can comment on or make changes to this bug.