Closed Bug 1217111 Opened 9 years ago Closed 6 years ago

Error while recording Video in Camera Application. "Video not recorded. An error prevented Camera from recording the video.”

Categories

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

ARM
Gonk (Firefox OS)

Tracking

(b2g-v2.2 affected, b2g-master unaffected)

RESOLVED WONTFIX
Tracking Status
b2g-v2.2 --- affected
b2g-master --- unaffected

People

(Reporter: yogendra, Unassigned)

References

Details

Attachments

(7 files, 1 obsolete file)

Steps to reproduce the issue.

1.Open Camera
2.Switch to Camcorder/Video mode
3.Start recording video
4.Stop recording video after 2-3 seconds
5.Repeat steps 3,4  5 to 6 times. 
6.Error dialog displayed with text “Video not recorded. An error prevented Camera from recording video”

Note:Some times issue is reproduced after 2-3 iteration, sometimes it may take more attempts.
Priority: -- → P1
I have analyzed the issue and please find my observations below:

Suppose video recording error is happening in nth recording. Events leading this issue are starting in n-2th recording.

For each video recording , when new video file is saved,  'CameraController:onStorageChanged' called 4 times.
CameraController:onStorageChanged called for events 1.created 2. modified 3.available
Below is the call stack for 'created' event

    1. Storage.onStorageChange, reason=created
    2. Storage.onStorageChange: calling setState
    3. Storage.setState, value=created
    4. StorageController.onChanged,state=created
    5. CameraController.onStorageChanged-->stopRecording


For each created and modified event, Storage.onStorageChange() initiates Storage.check() method which verifies storage and results in  StorageController:onChanged  callback with appropriate state like 'available' or 'unavailable'.

Storage.onStorageChange: --> initiates Storage.check ----> getstate-----> Storage.setState, value=available -->  step 4 --> step 5

In error scenario, StorageController:onChanged(available) calls of n-2th recording are getting delayed and they are called during n-1th recording start events. 

Events leading to error:

    1. n-2th recording stopped. (User clicks stop button).
    2. Video recording state set to false in gaia camera app and GonkRecorder instance is destroyed in   gecko. (in nsGonkCameraControl::StopRecordingImpl())
(In parallel to this, stopRecording is called from CameraController.onStorageChanged() )
    3. CameraController.onStorageChanged is received for events 'created' and 'modified'
    4. n-1th recording started (user   clicks start button ) and recording state set to true in gaia Camera App
    5. Delayed 3rd,4th  CameraController.onStorageChanged callbacks received for 'available' state and this stops the current recording session in gaia Camera App(recording state set to false)
    6. Video recording session created (GonkRecorder instanitiated in nsGonkCameraControl::SetupRecording()) in gecko.
    
Since camera app is in preview state, another video recording session  ( n th) initiated, which will be failed as there is already a video recording session in background (GonkRecorder is already initiated in n-1th recording)

nsGonkCameraControl::StartRecordingImpl()
{
...
NS_ENSURE_FALSE(mRecorder, NS_ERROR_FAILURE); //This check is failing.
...

}

Please let me know if any of my observations are not clear.
Yogendra: What device are you using? 

Is it happening on master too? Adding qawanted for master on our reference devices (flame/aries)
Keywords: qawanted
Yogendra: Can you also provide info on the gaia/gecko builds used
Flags: needinfo?(aosmond)
Attached file Logcat of issue on Flame 2.2 (obsolete) —
(In reply to Hema Koka [:hema] from comment #2)
> Is it happening on master too? Adding qawanted for master on our reference
> devices (flame/aries)

I was NOT able to repro this bug on master Aries or Flame; tried 50 times on each device and could not repro it. On Flame 2.2 the repro rate is very low (2 out of 40) when I tried it.

NOT reproducible after 50+ tries each:
Device: Aries Master
BuildID: 20151103140850
Gaia: 06de78d2c61c084956640c480280ba518b2fe29f
Gecko: 59a6ad6a921f4809dfc37d943d765300c65721e5
Gonk: a19052e4389c3ae2d8fc3e7a74a475401baacc56
Version: 45.0a1 (Master) 
Firmware Version: D5803_23.1.A.1.28_NCB.ftf
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0

Device: Flame Master
BuildID: 20151103030244
Gaia: 06de78d2c61c084956640c480280ba518b2fe29f
Gecko: bb4d614a0b09bcb9738c151dccfcd9b3857a6a7c
Gonk: 205ac4204bbbb2098a8046444acba551ba5dc75a
Version: 45.0a1 (Master) 
Firmware Version: v18Dv4
User Agent: Mozilla/5.0 (Mobile; rv:45.0) Gecko/45.0 Firefox/45.0

-----------

Reproducible on Flame 2.2 (rate 2 out of 40):
Device: Flame 2.2
BuildID: 20151103032504
Gaia: 885647d92208fb67574ced44004ab2f29d23cb45
Gecko: b8b7f4efaa6e
Gonk: bd9cb3af2a0354577a6903917bc826489050b40d
Version: 37.0 (2.2) 
Firmware Version: v18Dv4
User Agent: Mozilla/5.0 (Mobile; rv:37.0) Gecko/37.0 Firefox/37.0

Also attaching logcat reproducing the bug on 2.2.
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(jmercado)
Keywords: qawanted
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmercado)
Issue is reproduced frequently on our reference device (1 out of 5 times) on v2.2
Not verified on master.

Gaia/Gecko used:(v2.2)
Gaia:7a427e0f8aa6c185a9e22358006b97c19435ca4a
Gecko:27c9ffc29465d81c299e44d704e7e310765f22e1
Flags: needinfo?(aosmond)
Now that I think about this, this is probably the same as bug 1152500. I fixed many race conditions in gaia and gecko related to rapid recording start/stop and this is one of the conditions. We would need to uplift both the Gecko and Gaia changes to 2.5 to solve this.
Depends on: 1152500
(In reply to Andrew Osmond [:aosmond] from comment #6)
> the Gecko and Gaia changes to 2.5 to solve this.

Err *2.2*.
Comment on attachment 8683269 [details] [review]
[gaia] aosmond:bug1217111 > mozilla-b2g:v2.2

Rebased onto 2.2, carry r+ from bug 1152500.
Attachment #8683269 - Flags: review+
Assignee: nobody → aosmond
Status: NEW → ASSIGNED
Comment on attachment 8683269 [details] [review]
[gaia] aosmond:bug1217111 > mozilla-b2g:v2.2

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): N/A
[User impact] if declined: Video recording may fail if the user rapidly starts and stops recording.
[Testing completed]: Attempted to rapidly start/stop recordings without problem after applying both gecko and gaia patches. Been in use on master since June without issue. Added unit tests.
[Risk to taking this patch] (and alternatives if risky): Low.
[String changes made]: None.
Attachment #8683269 - Flags: approval-gaia-v2.2?(bajaj.bhavana)
Comment on attachment 8683282 [details] [diff] [review]
[gecko] fix start/stop recording race condition and error handling for 2.2, v1

NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): N/A
User impact if declined: Video recording may fail if the user rapidly starts and stops recording.
Testing completed: Attempted to rapidly start/stop recordings without problem after applying both gecko and gaia patches. Been in use on master since June without issues. Master patch added test cases but cannot push to 2.2 since the testing code has diverged so much.
Risk to taking this patch (and alternatives if risky): 
String or UUID changes made by this patch: None.
Attachment #8683282 - Flags: approval-mozilla-b2g37?
Attachment #8683269 - Flags: approval-gaia-v2.2?(bajaj.bhavana) → approval-gaia-v2.2?(jocheng)
Applied the patches 8683282 and 8683269 on the below build and verified the build for bug fix.

Gaia:5eea59998b53b725c66bdd664d33744759e43c3b
Gecko: e072060c28c5a0aa47783a414f1ef446d18cbbc9

On following the steps to reproduce the issue, after 4-5 successful recordings of duration 2-3 secs,
camera app screen remained in preview mode and all buttons became unresponsive.
Even on pressing video record start button, video recording not started.

I have attached the logcat logs "mainlog_20150511_142710.logcat"
Attachment #8683269 - Flags: approval-gaia-v2.2?(jocheng) → approval-gaia-v2.2?(mpotharaju)
Comment on attachment 8683269 [details] [review]
[gaia] aosmond:bug1217111 > mozilla-b2g:v2.2

Issue not entirely fixed. Not ready to uplift.
Attachment #8683269 - Flags: approval-gaia-v2.2?(mpotharaju) → approval-gaia-v2.2-
Comment on attachment 8683282 [details] [diff] [review]
[gecko] fix start/stop recording race condition and error handling for 2.2, v1

Not ready to uplift
Attachment #8683282 - Flags: approval-mozilla-b2g37? → approval-mozilla-b2g37-
Andrew, can you provide an update here? According to comment #14 it looks like Yogendra is still seeing this error.
Flags: needinfo?(aosmond)
Can you retest using the [debug] prefixed patches instead and provide me the logs? Thanks!
Flags: needinfo?(aosmond) → needinfo?(yogendra)
I have applied patch in Comment 18
(https://github.com/aosmond/gaia/commit/bd2408cbce239cb84ef981c326f541e3c62b1fd5) and Comment 19 and tested. Issue is reproduced and I have attached the logs.
Flags: needinfo?(yogendra)
logs ( attachment 8691238 [details]) have taken by applying all below three patches.
1. https://github.com/aosmond/gaia/commit/6ad2c173733c711c730d74e394c0b326c276d705
2.https://github.com/aosmond/gaia/commit/bd2408cbce239cb84ef981c326f541e3c62b1fd5
3. https://bugzilla.mozilla.org/attachment.cgi?id=8688502

With this build, issue is that after some 4-5 recordings, camcorder app remains in preview screen and video recording start button does not respond even if we click it.
Assignee: aosmond → nobody
Status: ASSIGNED → NEW
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

Created:
Updated:
Size: