Closed
Bug 1006281
Opened 10 years ago
Closed 10 years ago
[tarako]Camera app can't use internal storage when internal storage size is less than 5MB.
Categories
(Firefox OS Graveyard :: Gaia::Camera, defect)
Tracking
(blocking-b2g:1.3T+, b2g-v1.3T fixed, b2g-v1.4 fixed)
People
(Reporter: thomas, Assigned: justindarc)
Details
(Whiteboard: [tarako_only])
Attachments
(3 files)
https://github.com/mozilla-b2g/gaia/blob/v1.3t/apps/camera/js/camera.js#L1379-L1383 // Now verify that there is enough space to store a picture // 4 bytes per pixel plus some room for a header should be more // than enough for a JPEG image. var MAX_IMAGE_SIZE = (this._pictureSize.width * this._pictureSize.height * 4) + 4096; The jpeg file size is far smaller than the raw image size, so is it possible to check the file size after a jpeg file is generated? Since this internal storage is very small 10MB only.
Reporter | ||
Updated•10 years ago
|
blocking-b2g: --- → 1.3T?
Comment 1•10 years ago
|
||
triage: 1.3T+ to make use of the internal storage fully ni? djf Thanks
Comment 2•10 years ago
|
||
(In reply to thomas tsai from comment #0) > > is it possible > to check the file size after a jpeg file is generated? > Since this internal storage is very small 10MB only. The takePicture() callback returns a blob, which has a .size property[1]. 1. https://developer.mozilla.org/en-US/docs/Web/API/Blob#Properties
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jdarcangelo
Assignee | ||
Comment 3•10 years ago
|
||
Mike: The idea behind the file size guesstimate is to prohibit additional pictures from being taken if there's not enough space left to store them. We have another global constant in v1.4 that can estimate what the *JPEG* size will be which is what is needed here. Simply taking `width * height * 4` will give you the raw bitmap size (in bytes) which is overkill. Additionally, I think we're wrong in multiplying by `4` here anyway because shouldn't it really be 24-bits-per-pixel and not 32bpp?
Comment 4•10 years ago
|
||
Justin, Thanks for taking this. You're right that using 3 instead of 4 would have made more sense. In either case, though, that would be a extreme upper bound. It would be really bad if we allow the user to take a picture and then can't save it, so we need an upper bound on the file size that is very unlikely to be exceeded. I think I'd go with width * height * .5.
Flags: needinfo?(dflanagan)
Comment 5•10 years ago
|
||
The challenge is that the size of the final JPEG depends heavily on the content of the image. I can appreciate not wanting to put the person in a position where a taken photo can't be saved, but I wonder about preventing the user from taking a picture that -might- be able to be saved.
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8418249 -
Flags: review?(dflanagan)
Comment 7•10 years ago
|
||
Comment on attachment 8418249 [details] [review] pull-request (v1.3t) The code looks fine. I'd prefer a simpler calculation, though. See my comment on github.
Attachment #8418249 -
Flags: review?(dflanagan) → review+
Assignee | ||
Comment 8•10 years ago
|
||
Landed on v1.3t: https://github.com/mozilla-b2g/gaia/commit/746934a1e331b9ce578bd9fbdb4614d950baf765
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Comment 9•10 years ago
|
||
should this land on master as well?
Assignee | ||
Comment 10•10 years ago
|
||
I think we're ok on v1.4 and master since they both have the refactored camera. I remember introducing a piece of code that used a configurable average JPEG compression ratio for estimating file sizes.
Comment 11•10 years ago
|
||
Thank you for tarako only workaround.
Comment 12•10 years ago
|
||
We have kicked off v1.4 dolphin and shark project, we meeting this issue again. Yang, can you help to cherry-pick this patch to v1.4?
status-b2g-v1.4:
--- → affected
Flags: needinfo?(yang.zhao)
Comment 13•10 years ago
|
||
(In reply to James Zhang from comment #12) > We have kicked off v1.4 dolphin and shark project, we meeting this issue > again. > Yang, can you help to cherry-pick this patch to v1.4? Have conflicts when cherry-pick to v1.4.
Assignee | ||
Comment 14•10 years ago
|
||
This code is completely different in 1.4 and master. I will look at making a patch for 1.4/master.
Assignee | ||
Comment 15•10 years ago
|
||
David: Please have a quick look at this patch converted for 1.4/master. Thanks!
Attachment #8424892 -
Flags: review?(dflanagan)
Updated•10 years ago
|
Target Milestone: --- → 2.0 S1 (9may)
Comment 16•10 years ago
|
||
Comment on attachment 8424892 [details] [review] pull-request (master) Looks good to me.
Attachment #8424892 -
Flags: review?(dflanagan) → review+
Assignee | ||
Comment 17•10 years ago
|
||
Landed on master: https://github.com/mozilla-b2g/gaia/commit/d3b16b36d76b5713fe32b7a4dfa72cd9a88e6a32
Assignee | ||
Comment 18•10 years ago
|
||
Pull Request for v1.4 -- carrying R+ over from patch for master
Attachment #8425104 -
Flags: review+
Assignee | ||
Comment 19•10 years ago
|
||
Landed on v1.4: https://github.com/mozilla-b2g/gaia/commit/17b102ee8d9a724b62285547cc5f1c5d30bfb01c
Comment 20•10 years ago
|
||
Please see comment # 19,already landed in v1.4.
Flags: needinfo?(yang.zhao)
Updated•10 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•