Android with FFmpeg MediaCodec decoding reports support for high bit depth video the device cannot decode
Categories
(Core :: Audio/Video, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: aosmond, Assigned: aosmond)
References
(Blocks 4 open bugs)
Details
Attachments
(5 external files)
When decoding on Android goes through FFmpeg with MediaCodec (media.ffvpx-hw.enabled), colour depth is ignored when reporting decoder support. This shows up in navigator.mediaCapabilities.decodingInfo(): for example, 12-bit VP9 HDR (vp09.02.51.12...) is reported as powerEfficient, which makes the /_mozilla/media-capabilities/decodingInfo-api-modes.any.html?mode=supportscache WPT pass unexpectedly in bug 1981478.
Causes:
FFmpegDecoderModule::Supportsoverrides the base implementation without callingSupportsColorDepth, so MediaCodec is reported as available for VP8/VP9/AV1/H264/HEVC at any depth.RemoteDecoderModule::Supportsin the content process answers from the MIME type and the cachedMediaCodecsSupportedbits only, so it never sees colour depth either.FFmpegVideoDecoder::InitMediaCodecDecoderonly rejects content above 10-bit. ffvpx has no JavaVM set, so the decoder is created withAMediaCodec_createDecoderByTypewithout considering the profile, and may not support 10-bit at all.
MediaCodec cannot decode more than 10-bit, and 10-bit support depends on the device. The Java decoder path (AndroidDecoderModule) did check this, via HardwareCodecCapabilityUtils.decodes10Bit.
Proposed fix:
- Report 10-bit decoder support from
HardwareCodecCapabilityUtils.getSupportedMimeTypesWithAccelInfoand expose it through a newPlatformMediaCodecs10BitSupportedgfxVar. - Use it in
AndroidDecoderModule,FFmpegDecoderModule,FFmpegVideoDecoder::InitMediaCodecDecoderandRemoteDecoderModule. - MediaCodec support is only reported for 10-bit when a 10-bit decoder exists, and never above 10-bit. VP9 and AV1 still fall back to ffvpx software decoding at any depth; H264 and HEVC have no software fallback on Android.
| Assignee | ||
Comment 1•1 month ago
|
||
HardwareCodecCapabilityUtils.getSupportedMimeTypesWithAccelInfo now also lists
decoders which support a 10-bit profile, and the largest frame size supported
by hardware video decoders. These are exposed through the new
PlatformMediaCodecs10BitSupported gfxVar and the Platform*HwDecodeMaxSize
gfxVars for H264, HEVC, VP8, VP9 and AV1, so that both the content process and
the media processes can use them.
| Assignee | ||
Comment 2•1 month ago
|
||
These will be used by the decoder modules in the next part.
| Assignee | ||
Comment 3•1 month ago
|
||
MediaCodec support is now only reported for 10-bit video when the device has a
10-bit decoder for the codec, and never above 10-bit. Hardware support is also
dropped when the frame is larger than any hardware decoder supports.
AndroidDecoderModule, FFmpegDecoderModule, FFmpegVideoDecoder and
RemoteDecoderModule share the same rules, so the Java and NDK decoding paths
report the same support. H264 and HEVC report software decoding when the
platform has a software decoder, and hardware decoding when it is available.
| Assignee | ||
Comment 4•1 month ago
|
||
decodes10Bit has no remaining callers, and the encoder MIME types were always
requested from getSupportedMimeTypesWithAccelInfo.
| Assignee | ||
Comment 5•1 month ago
|
||
Comment 7•28 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/b2db439c86b6
https://hg.mozilla.org/mozilla-central/rev/873f7360b2c1
https://hg.mozilla.org/mozilla-central/rev/9bd172c3e05a
https://hg.mozilla.org/mozilla-central/rev/05f03bc6735a
https://hg.mozilla.org/mozilla-central/rev/5f8d8f74f76a
Updated•21 days ago
|
Description
•