Closed Bug 997150 Opened 10 years ago Closed 6 years ago

Unable to record video on Nexus S

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: gerard-majax, Unassigned)

References

Details

(Keywords: regression)

Attachments

(3 files)

After bug 997149 is fixed, recording a video fails with the following logcat:

I/Gecko   ( 6795): DSF (child) DeviceStorageCreateFdParams: mStorageType 'videos' mStorageName 'sdcard' mRootDir '' mPath 'DCIM/108MZLLA/VID_0478.3gp' mFile->GetPath '/mnt/sdcard/DCIM/108MZLLA/VID_0478.3gp'
E/CameraHardwareSec( 5183): Non-metadata buffer mode is not supported!
D/MPEG4Writer( 6795): Stopping Video track
E/MPEG4Writer( 6795): Stop() called but track is not started
Depends on: 997149
Mike, any idea what may be going wrong?

This used to work in the past, and as far as I remember, there has been some refactoring of the DOM Camera part, so it's probably a regression from this.
Flags: needinfo?(mhabicher)
Actually, I'm wondering if it's not a Gaia bug this time:
E/GeckoConsole( 1839): Content JS LOG at app://camera.gaiamobile.org/js/main.js:114 in debug/<: [camera] get free storage space +2s
E/GeckoConsole( 1839): Content JS LOG at app://camera.gaiamobile.org/js/main.js:114 in debug/<: [camera] -1524224000 free space found +113ms
I/Gecko   ( 1839): DSF (child) DeviceStorageCreateFdParams: mStorageType 'videos' mStorageName 'sdcard' mRootDir '' mPath 'DCIM/108MZLLA/VID_0482.3gp' mFile->GetPath '/mnt/sdcard/DCIM/108MZLLA/VID_0482.3gp'
Flags: needinfo?(wilsonpage)
gerard-majax: I'm not sure what you're asking me. If there is a problem is JS, I can fix it. If it's in Gecko, I can't.
Flags: needinfo?(wilsonpage)
I'm asking help to understand what the Camera app does to query space.
Flags: needinfo?(wilsonpage)
As far as I can tell, the Settings app does not have any issue returning the correct available side on my device (10.6GB).
(In reply to Alexandre LISSY :gerard-majax from comment #0)
> After bug 997149 is fixed, recording a video fails with the following logcat:
> 
> E/CameraHardwareSec( 5183): Non-metadata buffer mode is not supported!

This makes me think maybe storeMetaDataInBuffers() isn't being called.
Flags: needinfo?(mhabicher)
Ah ok. This function checks for remaining bytes in storage: https://github.com/mozilla-b2g/gaia/blob/master/apps/camera/js/lib/storage.js#L201
Okay, some news from this morning in the train: the debug message about free space is a false positive. It's just the debug() formatting that fails.

I found, however, an issue regarding some error handling on the createVideoFilepath side: in Storage.prototype.createVideoFilepath, the addNamed requests lacks an error handler. I've been able to hit this code path with a tmp.3gp file that was pre-existing on the storage, and the symptom was that the createVideoFilepath() method would never call the callback in Camera.prototype.startRecording, thus leaving the UI in a strange state: no error, no recording performed, clicking on buttons has no effect.

Besides, I'm still not able to perform recording: I'm getting a crash in the Camera app:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 5032.5071]
0x40d99f48 in DeviceStorageFileDescriptor::Release (this=0x430ec4e8, __in_chrg=<value optimized out>) at /home/alex/codaz/B2G/gecko/dom/devicestorage/DeviceStorageFileDescriptor.h:14
14	  NS_INLINE_DECL_REFCOUNTING(DeviceStorageFileDescriptor)
(gdb) bt
#0  0x40d99f48 in DeviceStorageFileDescriptor::Release (this=0x430ec4e8, __in_chrg=<value optimized out>) at /home/alex/codaz/B2G/gecko/dom/devicestorage/DeviceStorageFileDescriptor.h:14
#1  ~nsRefPtr (this=0x430ec4e8, __in_chrg=<value optimized out>) at ../../dist/include/nsAutoPtr.h:894
#2  0x40e390fa in ~Message (this=0x430ec4c0, __in_chrg=<value optimized out>) at /home/alex/codaz/B2G/gecko/dom/camera/CameraControlImpl.cpp:512
#3  0x40e39120 in ~Message (this=0x43040700, __in_chrg=<value optimized out>) at /home/alex/codaz/B2G/gecko/dom/camera/CameraControlImpl.cpp:512
#4  0x406bdf82 in nsRunnable::Release (this=0x430ec4c0) at /home/alex/codaz/B2G/gecko/xpcom/glue/nsThreadUtils.cpp:32
#5  0x406b4ebe in ~nsCOMPtr_base (this=0x44ce3e2c, __in_chrg=<value optimized out>) at ../../../dist/include/nsCOMPtr.h:448
#6  ~nsCOMPtr (this=0x44ce3e2c, __in_chrg=<value optimized out>) at ../../../dist/include/nsCOMPtr.h:491
#7  0x406efc4e in ~nsCOMPtr (this=0x42efda90, mayWait=true, result=0x44ce3e5f) at ../../dist/include/nsCOMPtr.h:491
#8  nsThread::ProcessNextEvent (this=0x42efda90, mayWait=true, result=0x44ce3e5f) at /home/alex/codaz/B2G/gecko/xpcom/threads/nsThread.cpp:704
#9  0x406bdfd0 in NS_ProcessNextEvent (thread=0x43040700, mayWait=true) at /home/alex/codaz/B2G/gecko/xpcom/glue/nsThreadUtils.cpp:263
#10 0x4083728e in mozilla::ipc::MessagePumpForNonMainThreads::Run (this=0x43857a60, aDelegate=0x440f40c0) at /home/alex/codaz/B2G/gecko/ipc/glue/MessagePump.cpp:336
#11 0x4082aca8 in MessageLoop::RunInternal (this=0x1000001) at /home/alex/codaz/B2G/gecko/ipc/chromium/src/base/message_loop.cc:226
#12 0x4082ad26 in MessageLoop::RunHandler (this=0x440f40c0) at /home/alex/codaz/B2G/gecko/ipc/chromium/src/base/message_loop.cc:219
#13 MessageLoop::Run (this=0x440f40c0) at /home/alex/codaz/B2G/gecko/ipc/chromium/src/base/message_loop.cc:193
#14 0x406f01e2 in nsThread::ThreadFunc (arg=<value optimized out>) at /home/alex/codaz/B2G/gecko/xpcom/threads/nsThread.cpp:311
#15 0x42124594 in _pt_root (arg=<value optimized out>) at /home/alex/codaz/B2G/gecko/nsprpub/pr/src/pthreads/ptthread.c:212
#16 0x40070c28 in __thread_entry (func=0x421244f1 <_pt_root>, arg=0x43040700, tls=<value optimized out>) at bionic/libc/bionic/pthread.c:217
#17 0x4007077c in pthread_create (thread_out=<value optimized out>, attr=0xbea3cd9c, start_routine=0x421244f1 <_pt_root>, arg=0x43040700) at bionic/libc/bionic/pthread.c:357
#18 0x00000000 in ?? ()
(gdb) quit
Flags: needinfo?(wilsonpage)
The crash in NS_INLINE_DECL_REFCOUNTING(DeviceStorageFileDescriptor) is a known issue that should be fixed soon.

The lack of an error handler for addNamed() is definitely a problem--not just for Nexus S.
Flags: needinfo?(jdarcangelo)
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Current Gecko master with a couple of hacks makes Video recording working. Mike, do you think I should do a patch for those ? (apart from the preview size change, which is a workaround for another bug).

$ git diff gfx/ dom/camera/
diff --git a/dom/camera/GonkCameraControl.cpp b/dom/camera/GonkCameraControl.cpp
index 276283e..67cee99 100644
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -1275,7 +1275,7 @@ nsGonkCameraControl::SetVideoSize(const Size& aSize)
   MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
 
   nsTArray<Size> videoSizes;
-  nsresult rv = mParams.Get(CAMERA_PARAM_SUPPORTED_VIDEOSIZES, videoSizes);
+  nsresult rv = mParams.Get(CAMERA_PARAM_SUPPORTED_PREVIEWSIZES, videoSizes);
   if (NS_FAILED(rv)) {
     DOM_CAMERA_LOGE("Camera failed to return any video sizes (0x%x)\n", rv);
     return rv;
diff --git a/gfx/layers/GrallocImages.cpp b/gfx/layers/GrallocImages.cpp
index a5a01c4..bb4bed7 100644
--- a/gfx/layers/GrallocImages.cpp
+++ b/gfx/layers/GrallocImages.cpp
@@ -34,6 +34,7 @@ uint32_t GrallocImage::sColorIdMap[] = {
     HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED, HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED,
     HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS, HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS,
     HAL_PIXEL_FORMAT_YV12, OMX_COLOR_FormatYUV420Planar,
+    HAL_PIXEL_FORMAT_YCbCr_420_SP_POWERVR, OMX_COLOR_FormatYUV420SemiPlanar, 
     0, 0
 };
 
diff --git a/gfx/layers/GrallocImages.h b/gfx/layers/GrallocImages.h
index 1cbd77a..db2b87e 100644
--- a/gfx/layers/GrallocImages.h
+++ b/gfx/layers/GrallocImages.h
@@ -73,6 +73,7 @@ public:
   // From [android 4.0.4]/hardware/msm7k/libgralloc-qsd8k/gralloc_priv.h
   enum {
     /* OEM specific HAL formats */
+    HAL_PIXEL_FORMAT_YCbCr_420_SP_POWERVR   = 0x100,
     HAL_PIXEL_FORMAT_YCbCr_422_P            = 0x102,
     HAL_PIXEL_FORMAT_YCbCr_420_P            = 0x103,
     HAL_PIXEL_FORMAT_YCbCr_420_SP           = 0x109,
Flags: needinfo?(mhabicher)
(In reply to Alexandre LISSY :gerard-majax from comment #10)
>
> Current Gecko master with a couple of hacks makes Video recording working.
> Mike, do you think I should do a patch for those ? (apart from the preview
> size change, which is a workaround for another bug).
> 
> $ git diff gfx/ dom/camera/
> diff --git a/dom/camera/GonkCameraControl.cpp
> b/dom/camera/GonkCameraControl.cpp
> index 276283e..67cee99 100644
> --- a/dom/camera/GonkCameraControl.cpp
> +++ b/dom/camera/GonkCameraControl.cpp
> @@ -1275,7 +1275,7 @@ nsGonkCameraControl::SetVideoSize(const Size& aSize)
>    MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
>  
>    nsTArray<Size> videoSizes;
> -  nsresult rv = mParams.Get(CAMERA_PARAM_SUPPORTED_VIDEOSIZES, videoSizes);
> +  nsresult rv = mParams.Get(CAMERA_PARAM_SUPPORTED_PREVIEWSIZES,
> videoSizes);
>    if (NS_FAILED(rv)) {
>      DOM_CAMERA_LOGE("Camera failed to return any video sizes (0x%x)\n", rv);
>      return rv;

I can't comment on the other patches, but I'm all for keeping the Nexus S working. With regards to the change above, can you check whether or not the change to GonkCameraControl.cpp in bug 987068 fixes your issue?
Flags: needinfo?(mhabicher)
Mike, I'm still hitting this issue, but I noticed that if I use a low resolution recording profile ('low', 'qcif'), it does work.

High quality ('high', '480p') always lead to "." error message in Camera app, and there is nothing obvious popping in the logcat.
Flags: needinfo?(jdarcangelo) → needinfo?(mhabicher)
If you can rebuild Gecko with the null-#define of DOM_CAMERA_LOG in dom/camera/CameraCommon.h redefined to printf_stderr(__VA_ARGS__) and grab the logcat, it should show us where things are dying.
Flags: needinfo?(mhabicher)
Here is the log of recording when setting the 480p profile.
Flags: needinfo?(mhabicher)
So it seems to be related to the audio profile. Having a look at media_profiles.xml, we can see:
 - qcif uses armnb
 - 480p uses aac
Mike, this is of course a hack we do not want to land as-is, but this is making my device able to record 480p again.
Attachment #8467876 - Flags: feedback?(mhabicher)
Flags: needinfo?(mhabicher)
Comment on attachment 8467876 [details] [diff] [review]
0001-Bus-997150-Enable-AAC-audio-profile-on-Nexus-S.patch

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

LGTM, though I don't have a Nexus S handy to try it out on. :) I wonder what this breaks on other platforms....
Attachment #8467876 - Flags: feedback?(mhabicher) → feedback+
Alexandre, is this issue still plaguing your Nexus S? If so, we should see about getting attachment 8467876 [details] [diff] [review] landed.
Flags: needinfo?(lissyx+mozillians)
Well, I have this patch included in my Nexus S builds, so I haven't retried without for a while. I'll retry without and keep you posted.
I can confirm this is still needed.
Flags: needinfo?(lissyx+mozillians) → needinfo?(mhabicher)
We* should get it landed.

*you :)
Flags: needinfo?(mhabicher)
(In reply to Mike Habicher [:mikeh] from comment #18)
> Comment on attachment 8467876 [details] [diff] [review]
> 0001-Bus-997150-Enable-AAC-audio-profile-on-Nexus-S.patch
> 
> Review of attachment 8467876 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> LGTM, though I don't have a Nexus S handy to try it out on. :) I wonder what
> this breaks on other platforms....

https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=e2f622dcd6aa
Flags: needinfo?(mhabicher)
Johan, do you think you could give a try to testing this on your Flame JB and KK ?
Flags: needinfo?(jlorenzo)
Redirecting to No-Jun, who's the QA contact on the Camera app.
Flags: needinfo?(jlorenzo) → needinfo?(npark)
And no need to test on Flame JB as that's a dead platform.
Flags: needinfo?(mhabicher)
I tested this patch on v184 / master branch, and it looks good.
Flags: needinfo?(npark)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: