Closed Bug 2080180 Opened 1 month ago Closed 11 days ago

Make MediaCodec decoders work in the GPU process as well as RDD

Categories

(Core :: Audio/Video: Playback, task)

All
Android
task

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox161 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

(Blocks 5 open bugs)

Details

Attachments

(3 external files)

This blocks AImageReader from just working because we are in the wrong process. We need the RDD in case we fall back to parent process compositing on Android, but we can default to using the GPU process for decoding for AImageReader purposes.

D279451 of Bug 1649110 pref change enables AImageReader and native MediaCodec in GPU process.

Depends on: 2082552
Blocks: 2066002
Blocks: 2080075

This allows MediaCodec video decoding to use AImageReader. The CDM must be in
the same process as the decoders using it, so the CDM is created in the GPU
process when decoding there is enabled, and only then may audio be decoded
there. If the GPU process is disabled, we fall back to the RDD process. We also
no longer disable decoding in the GPU process separately on Android after
crashes, so a decoder which repeatedly crashes the GPU process will cause it to
be relaunched until it is disabled entirely after too many restarts. The GPU
process now also probes for MediaCodec encoders, so that encoding is preferred
there in the same way, and the media manager endpoint for the GPU process is
created if either decoding or encoding there is enabled.

The RDD process no longer creates MediaCodec decoders or encoders while the GPU
process is enabled and decoding or encoding in it is preferred, and the content
process no longer reports hardware decoding support for the RDD process then.
Pure software decoding and encoding with ffvpx may still be performed outside
of the GPU process since it is not permitted there.

Note that if creating a decoder in the GPU process fails for a reason other
than a crash, we no longer retry with MediaCodec in the RDD process, so codecs
without a software decoder, such as H264 and HEVC, will fail to decode.

The test checks that video decoding prefers the GPU process, and that only
hardware decoding is performed in the GPU process, and only software decoding
is performed in the RDD process unless the GPU process is unavailable.

Blocks: 2086278
Pushed by aosmond@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e16a53883576 https://hg.mozilla.org/integration/autoland/rev/8cd5e3a984a9 Part 1. Prefer decoding and encoding in the GPU process on Android, including with a CDM. r=media-playback-reviewers,alwu https://github.com/mozilla-firefox/firefox/commit/7b75939485a1 https://hg.mozilla.org/integration/autoland/rev/f7acecbf2a9f Part 2. Only fallback to platform decoding and encoding in the RDD process on Android if the GPU process is disabled. r=media-playback-reviewers,alwu https://github.com/mozilla-firefox/firefox/commit/32d91c7937fb https://hg.mozilla.org/integration/autoland/rev/15f537110a84 Part 3. Use the GPU process for encoding/decoding with Android isolated process tests by default. r=media-playback-reviewers,alwu
Status: ASSIGNED → RESOLVED
Closed: 11 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: