Closed Bug 951099 Opened 11 years ago Closed 10 years ago

[Flatfish][Camera] Camera hangs (black viewfinder) when trying to take video

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ericcc, Unassigned)

References

Details

(Whiteboard: [flatfish][TCP=breakage])

Gaia      545aacf3feff6430140cc9ade757002df4895b77  │  
Gecko     b70b6647aa71a00afb1f7bc172856607f15d46fc  │  
BuildID   20131217171116                            │  
Version   29.0a1                                    │  
ro.build.version.incremental=20131217               │  
ro.build.date=Tue Dec 17 17:13:45 CST 2013  

1. Open Camera, Tap Video Recorder
2. <ISSUE> Camera app crashes.
Update the status of 4/8 code base:
Gaia 650e8c2c611ed07495d3bf3769f44a0efd88a492
Gecko f9ca77bae16bd40a1446ed812af3dcdba14a9e09

The Camera app can take pitures.
When switching to Video Recorder, Camera app will hang and the preview screen is black.
In that case, we can only kill Camera app in task list to recover it.
Summary: [Flatfish][Camera] Camera Crashed when trying to take video → [Flatfish][Camera] Camera hangs (black viewfinder) when trying to take video
The following is the logs refer to the issue:
W/V4L2CameraDevice( 1264): should stop capture now
E/GeckoConsole( 2388): Content JS LOG at app://camera.gaiamobile.org/js/main.js:3453 in Camera.prototype.configure: mozCamera configuration pw: 640, ph: 480
D/camera  ( 2388): Preview paused
I/camera  ( 2388): virtual nsresult mozilla::nsGonkCameraControl::SetConfigurationImpl(const mozilla::ICameraControl::Configuration&):226
I/camera  ( 2388): nsresult mozilla::nsGonkCameraControl::SetConfigurationInternal(const mozilla::ICameraControl::Configuration&):183
I/camera  ( 2388): nsresult mozilla::nsGonkCameraControl::SetVideoConfiguration(const mozilla::ICameraControl::Configuration&):269
I/camera  ( 2388): nsresult mozilla::nsGonkCameraControl::SetupVideoMode(const nsAString_internal&):1115
I/camera  ( 2388): already_AddRefed<mozilla::GonkRecorderProfile> mozilla::GonkRecorderProfileManager::Get(char const*) const:234 : aProfileName='low'
I/camera  ( 2388): mozilla::RecorderProfile::RecorderProfile(uint32_t, uint32_t):135 : this=0x455858e0
I/camera  ( 2388): mozilla::RecorderVideoProfile::RecorderVideoProfile(uint32_t, uint32_t):18 : this=0x455858f8
I/camera  ( 2388): mozilla::GonkRecorderVideoProfile::GonkRecorderVideoProfile(uint32_t, uint32_t):170 : this=0x455858f8, mCameraId=0, mQualityIndex=0
I/camera  ( 2388): mozilla::RecorderAudioProfile::RecorderAudioProfile(uint32_t, uint32_t):79 : this=0x4558591c
I/camera  ( 2388): mozilla::GonkRecorderAudioProfile::GonkRecorderAudioProfile(uint32_t, uint32_t):140 : this=0x4558591c, mCameraId=0, mQualityIndex=0
I/camera  ( 2388): mozilla::RecorderProfileBase<Audio, Video>::RecorderProfileBase(uint32_t, uint32_t) [with Audio = mozilla::GonkRecorderAudioProfile, Video = mozilla::GonkRecorderVideoProfile, uint32_t = unsigned int]:153 : this=0x455858e0
I/camera  ( 2388): mozilla::GonkRecorderProfile::GonkRecorderProfile(uint32_t, uint32_t):79 : this=0x455858e0, mCameraId=0, mQualityIndex=0
D/camera  ( 2388): Created camera 0 profile index 0: 'low'
D/camera  ( 2388): Pulling camera parameters
D/camera  ( 2388): Begin deferring camera configuration updates (nest level 1)
D/camera  ( 2388): Camera parameter 29 not available (value is null)
D/camera  ( 2388): End deferring camera configuration updates (nest level 1)
I/camera  ( 2388): nsresult mozilla::nsGonkCameraControl::PushParameters():305
D/camera  ( 2388): Pushing camera parameters
I/camera  ( 2388): nsresult mozilla::nsGonkCameraControl::SetConfigurationInternal(const mozilla::ICameraControl::Configuration&):200
D/camera  ( 2388): Stopping preview (this=0x45bd1bf0)
I/camera  ( 2388): virtual void android::GonkCameraHardware::StopPreview():335 : this=0x44471a40
D/camera  ( 2388): Preview stopped, clearing current frame
D/GonkNativeWindow( 2388): GonkNativeWindow::returnBuffer
V/GonkConsumerBase( 2388): addReleaseFenceLocked: slot=2
V/GonkConsumerBase( 2388): releaseBufferLocked: slot=2
V/camera  ( 2388): Camera control API failed at 6 with 0x80070057
D/camera  ( 2388): DOM OnError context=6, error='FAILURE'
E/GeckoConsole( 2388): Content JS LOG at app://camera.gaiamobile.org/js/main.js:3437 in Camera.prototype.configure/error: Error configuring camera
Using configuration values of Video preview:
(gdb) p aConfig
$1 = (const mozilla::ICameraControl::Configuration &) @0x44fa2920: {mMode = mozilla::ICameraControl::kVideoMode, mPreviewSize = {
    width = 640, height = 480}, mRecorderProfile = {<nsAString_internal> = {mData = 0x44e56698 u"low", mLength = 3, mFlags = 
    5}, <No data fields>}}
V/camera  ( 2388): Camera control API failed at 6 with 0x80070057

...6 = SetConfiguration(), 0x80070057 = NS_ERROR_INVALID_ARG. Note that the "6" value will change if you have bug 965420 applied.

D/camera  ( 2388): DOM OnError context=6, error='FAILURE'

Also, "FAILURE" will be a more useful value once bug 985496 (re)lands.
(In reply to Mike Habicher [:mikeh] from comment #4)
> ...6 = SetConfiguration(), 0x80070057 = NS_ERROR_INVALID_ARG. Note that the
> "6" value will change if you have bug 965420 applied..
Thank you for the information and I gave a try on the patch. I have "NS_IMPL_CYCLE_COLLECTION_INHERITED_18" in my code base but the patches expect "NS_IMPL_CYCLE_COLLECTION_INHERITED_19". I will try the patches of bug 985496 first.

I collect the values of init config for photo preview:
Photo:
(gdb) p aConfig
$3 = (const mozilla::ICameraControl::Configuration &) @0x44a80c84: {mMode = mozilla::ICameraControl::kPictureMode, mPreviewSize = {
    width = 0, height = 0}, mRecorderProfile = {<nsAString_internal> = {mData = 0x44d56678 u"cif", mLength = 3, mFlags = 
    5}, <No data fields>}}
I note that the PreviewSize and RecorderProfile are different from video preview config.
After upgraded to the last code base and applied the bug 985496 patches, I still get the meaningless value 'FAILURE': 
D/camera  ( 1726): DOM OnUserError aContext=8, error='FAILURE'
E/GeckoConsole( 1726): Content JS LOG at app://camera.gaiamobile.org/js/main.js:4262 in onError: Error configuring camera

I will do more study on "mozilla::ICameraControl::Configuration" because of the messages: 
D/camera  ( 1726): Camera parameter 30 not available (value is null)

Any suggestion is welcome.
Jeff, to still see 'FAILURE' I think you must have applied an old version of the bug 985496 patch. The version currently checked into m-c and b2g-inbound doesn't report 'FAILURE' anymore. What tree are you building from?

Also, there should be a line directly above this message that looks like, "Camera control API failed at 8 with 0x80070057". Even if you're still seeing 'FAILURE', you can decode the 32-bit hex error number using this site: http://james-ross.co.uk/mozilla/misc/nserror
Regarding "Camera parameter 30 not available (value is null)", you can look those values up here[1]. In this case (assuming you're running a current build), parameter 30 is CAMERA_PARAM_SUPPORTED_VIDEOSIZES[2]. It's normal for this value to be missing on lower-end hardware, so depending on your platform, this might not be the cause of the failure.

1. http://dxr.mozilla.org/mozilla-central/source/dom/camera/ICameraControl.h
2. http://dxr.mozilla.org/mozilla-central/source/dom/camera/ICameraControl.h#59
Mike, Thank you for the information.
(In reply to Mike Habicher [:mikeh] from comment #7)
> Jeff, to still see 'FAILURE' I think you must have applied an old version of
> the bug 985496 patch. The version currently checked into m-c and b2g-inbound
> doesn't report 'FAILURE' anymore. What tree are you building from?
I am in m-c but the last commit is around 4/29. I just perform repo sync and the bug 985496 patches is merged.
I get the follow error messages with new code base: D/camera  ( 1717): DOM OnUserError aContext=8, error='InvalidArgument'
I wonder whether the id 8 of aContext is mapping to CAMERA_PARAM_PICTURE_DATETIME?
http://dxr.mozilla.org/mozilla-central/source/dom/camera/ICameraControl.h#35
(In reply to Jeff Chuang from comment #9)
>
> I get the follow error messages with new code base: D/camera  ( 1717): DOM
> OnUserError aContext=8, error='InvalidArgument'
> I wonder whether the id 8 of aContext is mapping to
> CAMERA_PARAM_PICTURE_DATETIME?
> http://dxr.mozilla.org/mozilla-central/source/dom/camera/ICameraControl.h#35

No, 8 is the method that was called that triggered the error. In this case, setConfiguration()[1].

1. http://dxr.mozilla.org/mozilla-central/source/dom/camera/CameraControlListener.h#95
Whiteboard: [Flatfish only][developer+] → [flatfish][TCP]
Whiteboard: [flatfish][TCP] → [flatfish][TCP=breakage]
Blocks: flatfish
Not able to reproduce on latest build, but different issue found. Check bug 1049420 for follow up.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.