Closed Bug 933154 Opened 11 years ago Closed 10 years ago

[B2G][Helix][camera][dingyu]Start the video recording failed

Categories

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

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: lecky.wanglei, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1

Steps to reproduce:

1. open the camera and toggle to video mode
2. press the caputre button to start a video recording 
3. press the home key to make the camera work in background 
4. press the camera button and go back to the camera 
5. repeat 2 ~ 4 quickly



Actual results:

a dialog box show that "Video not recorded, An error prevented Camera from recording the video"


Expected results:

start recording successfully
According to the log:
nsresult mozilla::nsGonkCameraControl::SetupRecording(int, int, int64_t, int64_t):1320 : mCameraHw is null
It means the mCameraHw is null, so the api startRecording return false and the dialog box appeared.

Compare the normal log and abnormal log I find that:
mCameraHw is define in GonkCameraControl.cpp L239: mCameraHw = GonkCameraHardware::Connect(this, mCameraId);(I am not sure of that)
According to the log, when the issue happens, the time of define "mCameraHw" is after than the judgment RETURN_IF_NO_CAMERA_HW in function "nsGonkCameraControl::SetupRecording"(in GonkCameraControl.cpp).

I try to find the original location to call "mCameraHw = GonkCameraHardware::Connect" and "nsGonkCameraControl::SetupRecording". But I am sorry I only find that:
"mCameraHw = GonkCameraHardware::Connect" is from "nsDOMCameraManager::GetCamera()" (in DomCameraManger.cpp)
"nsGonkCameraControl::SetupRecording" is from "nsDOMCameraControl::StartRecording"(in DomCameraControl.cpp)

So in my opinion, the reason is as follow: when I open the camera, nsDOMCameraManager::GetCamera will go and the mCameraHw  will be defined. Because of my pressing the capture button so quickly that at the time "RETURN_IF_NO_CAMERA_HW " to check the mCameraHw, actually the "mCameaHw" have not be defined.
blocking-b2g: --- → hd?
Flags: needinfo?(wchang)
Priority: -- → P2
I think in camera.js we set some time delay befor we call the api "startRecording". it maybe helpful.
Not blocking HD.

Vincent, can you check this and nominate for koi if you think the fix is worth it?
blocking-b2g: hd? → ---
Flags: needinfo?(wchang) → needinfo?(vliu)
(In reply to lecky from comment #1)
> 
> Compare the normal log and abnormal log I find that:
> mCameraHw is define in GonkCameraControl.cpp L239: mCameraHw =
> GonkCameraHardware::Connect(this, mCameraId);(I am not sure of that)

This function get camera hw ownership from CameraService in android mediaserver. If this function failed, the problem happens in CameraService side.
(In reply to lecky from comment #2)
> I think in camera.js we set some time delay befor we call the api
> "startRecording". it maybe helpful.

I do not think it is a good idea without analyzing the actual cause of the problem.
I think the solution is that the 'visibilitychange' event handler[1] needs to call disableButtons() to make sure we can't tap on the start-recording button until the preview has restarted.

1. https://github.com/mozilla-b2g/gaia/blob/master/apps/camera/js/camera.js#L1540
lecky, can you try out this patch?
Attachment #825356 - Flags: feedback?(lecky.wanglei)
Flags: needinfo?(lecky.wanglei)
Flags: needinfo?(vliu)
(In reply to Sotaro Ikeda [:sotaro] from comment #4)

> This function get camera hw ownership from CameraService in android
> mediaserver. If this function failed, the problem happens in CameraService
> side.
In my opinion, the function get camera hw ownership doesn't failed. Because I use continuous auto focus in preview, so If i open the camera then press the capture button quickly, the api "startRecording" is running quickly. In my thought, the reason of the problem is that when I open the camera the function "navigator.mozCameras.getCamera" will call to define mCameraHw, before the mCameraHw is defined, "RETURN_IF_NO_CAMERA_HW " is called. 
  I think Camera.disableButtons(); add after https://github.com/mozilla-b2g/gaia/blob/master/apps/camera/js/camera.js#L1540 will more better? do you think so?
Flags: needinfo?(lecky.wanglei)
lecky, have you tried the above patch (or your suggestion in comment 9)?
Flags: needinfo?(lecky.wanglei)
(In reply to Mike Habicher [:mikeh] from comment #10)
> lecky, have you tried the above patch (or your suggestion in comment 9)?

Mike I have try the patch, the probability become small, but the problem is still exist.But if I merge the patch, when it failed, the log is not the same as previous.
Flags: needinfo?(lecky.wanglei)
Priority: P2 → P3
This does not reproduce anymore:

Gaia      6a1373340b40fcfe901336bc9e80676e5f2ba979
Gecko     https://hg.mozilla.org/releases/mozilla-aurora/rev/82ef9bf64d87
BuildID   20140626000202
Version   32.0a2

Please reopen if you're able to reproduce.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: