Mobile/Firefox for Android/shutdown decoder: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "=Overview= Suspending video element's video decoder, when the video element is in background tabs or is invisible even in the foreground tab, is a Firefox feature that reduces...")
 
Line 30: Line 30:


=Engineer Owner=
=Engineer Owner=
Max Liu [:maliu]
Tzuhao Kuo [:kaku]


=QA Contact=
=QA Contact=

Revision as of 07:37, 10 March 2017

Overview

Suspending video element's video decoder, when the video element is in background tabs or is invisible even in the foreground tab, is a Firefox feature that reduces CPU/GPU & memory usage.

The mechanism is that, when a video element is invisible, we replace its original video decoder with blank video decoder which only produces white frames with right resolution and right time information. The original video decoder is released and the black video decoder is light so that we reduce CPU/GPU & memory usage.

The drawback is that, while the suspended-video-element is switched back to be visible again, we should resume its original video decoder. The resuming operation must be asynchronous and might be time-consuming which depends on the resolution of the video file and whether it contains audio tracks or not.

In the prototype (Phase 0), we have enabled this feature on the Firefox Nightly channel for any video element. We also add telemetry to collect needed information, especially on the resuming time. Currently (Phase 1), we are going to enable this feature on the Firefox Release channel for videos that is able to be resumed quickly and the criteria is 1) videos without audio track or 2) videos with both audio and video tracks but with low resolution (480P for now). In the future (Phase 2), our goal is to enable this feature on all videos without observable latency while resuming.

The following is a step-by-step description of suspending decoder working flow.

  1. At the very beginning of the decoding framework, the raw media data is sent to demuxer.
  2. Demuxer helps to separate a combined signal, e.g., a streaming can be separated into audio data and video data by demuxer. After that, audio and video data are sent to audio and video decoder separately.
  3. In data decoding period, audio decoder keeps working as normal because a user may be listening to the music. But, Firefox uses a blank video decoder to replace current video decoder if the video element is invisible.

Fx Shutdown Decoder Architecture v2.png

Overall Project Health

[GREEN, ON TRACK]

  • 100% of Release 53 commitment completed.
  • 14 MVP bugs are planned, 100% completion rate Targeting Firefox53.
  • QA has checked 100% of all bugs, bringing 16 more bugs for further clarification and follow-up.
  • In total, we have 29 bugs for tracking, 24 out of these 29 bugs are resolved, representing a 83% completion rate.

Target Milestone

Firefox53

Program MANA status Update

Engineer Owner

Tzuhao Kuo [:kaku]

QA Contact

Ioana Chiorean <ioana.chiorean@softvision.ro>
Sorina Florean [:sorina] <sorina.florean@softvision.ro>


Status

Phases

Program Status

Milestone Target Status
Phase 1 54 on Nightly
Phase 2 NOT STARTED
  • Phase 1: Using a blank video decoder to replace video decoder instead of shutdown decoders directly. In this phase, the mechanism is applied to 1) Low-resolution video (480P) and 2) Video film without audio track
  • Phase 2: We're going to enhance the mechanism and make sure it can apply to all video files.

Testing

Test cases: Phase 1


MVP Scope

bug 1293963 - [Meta] Suspend-video-decoder: phase-1 shipping
Full Query
ID Priority Component Assigned to Summary Status Target milestone
1276556 P3 Audio/Video: Playback [META] Tracking enable of background tab video decoder suspend NEW ---
1294349 -- Audio/Video: Playback Gerald Squelart (he/him) (not at Mozilla since 2022-09-15) Telemetry to support background video decoder suspend: Recovery time from video-decode-suspended RESOLVED mozilla51
1294656 -- Audio/Video: Playback Tzuhao Kuo [:kaku] Seek to nearest keyframe when resuming videos with no audio - no audio track RESOLVED mozilla51
1305338 P1 Audio/Video: Playback Mark Liang(:mark_liang) [UX] UX Spec for Shutdown Decoder Phase 1 RESOLVED ---
1309492 P3 Audio/Video: Playback Tzuhao Kuo [:kaku] If a video element's video is suspended, make it draw black frames. RESOLVED ---
1309494 P3 Audio/Video: Playback Tzuhao Kuo [:kaku] Use spinning loading UI if resuming video element's video decoder is longer than 250ms. RESOLVED mozilla55
1345403 -- Audio/Video: Playback Tzuhao Kuo [:kaku] Mark a video element as taint and never suspend it again if it is passed into drawImage() RESOLVED mozilla55
1346116 -- Audio/Video: Playback Tzuhao Kuo [:kaku] Consider a video element is in tree or not to suspend its video decoder RESOLVED mozilla55
1346120 -- Audio/Video: Playback Tzuhao Kuo [:kaku] If a video element's video is suspended, keep the last decoded video frame on the screen RESOLVED mozilla55
1346235 P1 Audio/Video John Lin [:jhlin][:jolin] Fennec has stopped working while playing videos VERIFIED Firefox 55
1348432 P1 Audio/Video: Playback Tzuhao Kuo [:kaku] Missing audio in YouTube videos that were requested within the same tab. Refreshing page fixes audio. VERIFIED mozilla55
1348864 P1 Audio/Video Tzuhao Kuo [:kaku] Black frame displayed on video decoder resume RESOLVED ---
1349456 -- Audio/Video: Playback Tzuhao Kuo [:kaku] Mark a video element as taint and never suspend it again if it is aptured via mozCaptureStream() RESOLVED mozilla55
1349459 -- Audio/Video: Playback Tzuhao Kuo [:kaku] Mark a video element as taint and never suspend it again if it is passed into createImageBitmap() VERIFIED mozilla55
1365581 P3 Audio/Video Tzuhao Kuo [:kaku] [Shutdown Decoder] OGV video elements are not suspended. RESOLVED ---
1365584 P1 Audio/Video Tzuhao Kuo [:kaku] [Shutdown Decoder] On WEBM video element resume the player returns a error RESOLVED ---
1369970 -- Audio/Video: Playback Tzuhao Kuo [:kaku] [Shutdown Decoder] enable the preference. RESOLVED mozilla55

17 Total; 1 Open (5.88%); 13 Resolved (76.47%); 3 Verified (17.65%);


Reference

Decoder resuming latency

While the suspended-video-element is switched back to be visible again, we should resume its original video decoder. The resuming operation must be asynchronous since we don't want to block the main thread and might be time-consuming which depends on the resolution of the video file and whether it contains audio tracks or not.

Currently, we have no way to boost the resuming time, however, we have telemetries for collecting the needed time of different resolutions on different platforms.