Firefox/Shutdown Decoders: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 13: Line 13:
# In data decoding period, audio decoder keeps working as normal because 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.
# In data decoding period, audio decoder keeps working as normal because 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.


[[File:Fx_Shutdown_Decoder_Architecture.png|800px|frameless]]
[[File:Fx_Shutdown_Decoder_Architecture_v2.png|800px|frameless]]





Revision as of 07:08, 24 August 2016

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 is sent to audio and video decoder separately.
  3. In data decoding period, audio decoder keeps working as normal because 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


Key Documents

Other Resources

  • Etherpad: Constructing...

Install

Stable Release

Stay tuned.

Developer Release

The developer release is updated each time code is committed to Mozilla-central in HG.

Reporting Issues

If you find a bug or have a suggestion, please submit it on Bugzilla: https://goo.gl/coRinl

Planning

Goals

  • Help users to reduce device resource usage (CPU & Memory)
  • Finish tasks across videos
  • No impact in current user flow

Feature Plan

  • Phase 0: Shutdown decoders when video element is invisible
  • 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.

Success

  • Effective cross discipline teams solving problems across platforms
  • Validation of key assumptions through telmetrics
  • video decode suspend in the hands of all our users

Schedule

Product Milestones

Engineering

Shutdown_Decoders [status: Green]

Current Goals:

  • Ship disabling video decoders for ads
  • Silent, looping videos where user doesn't really care the exact point

Next Milestone:


Milestones

Blank Previous Frame

Optimizations

  • For video elements off screen (using layout notification) - Kaku, http://bugzil.la/1282710
  • Resume video when mouse pointer starts hovering tab - https://bugzil.la/1274919 - Dan
    • In review. Needs response to mconley.
  • Resume video when keyboard is used to change tags - Needs Bug
    • For example, if it's possible to detect the direction of cycling and videos are within, say, 5 tabs of the current tab, then start decoding again.
    • Need to hook into the tab navigation/change code and alert media elements, like bug 1274919
  • Seek to nearest keyframe when video has no audio - http://bugzil.la/1282012 - Kaku

Telemetry

Mochitests

Currently no tests, need some to ensure that behaviour doesn't break http://bugzil.la/1284177 Add tests for suspending offscreen videos. Test no visible JS events because of suspending decode.

Team

Product owner:

Eng: Alastor, Daniel, Gerald, JW, Kaku,

Program Management: Blake, Josh

UX:

QA: SoftVision and William

Communications

IRC:

Email:

VidyoRoom: