Skip to content

[GStreamer] Use an explicit allowlist of AAC AOTs - #61915

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
ntrrgc:pr-2026-04-02-aac-aots
Apr 6, 2026
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
ntrrgc:pr-2026-04-02-aac-aots

Conversation

@ntrrgc

@ntrrgc ntrrgc commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

e33ca76

[GStreamer] Use an explicit allowlist of AAC AOTs
https://bugs.webkit.org/show_bug.cgi?id=311347

Reviewed by Philippe Normand.

Currently the GStreamer ports of WebKit report support to any codec
string starting with "mp4a" if there is a decoder that supports
audio/mpeg, mpegversion=4. This is too optimistic and can lead to
applications choosing to use newer MPEG-4 Audio codecs not yet
supported by the user's system.

This patch makes WebKit play it safer and instead only report support
for AOTs with widespread support.

This includes reporting AOT 42 (typically used with xHE-AAC) as not
supported. Ideally we would query support for it somehow and reply
accordingly, but that would necessitate decoders to provide a uniform
API for querying such support, which unfortunately does not exist (and
would be tricky in practice as support is not always binary). An
environment variable is provided to declare explicit support or lack
thereof in environments where this is well-known, as well as for
debugging and experimentation.

See: WebPlatformForEmbedded/WPEWebKit#1641 (but
note that this patch takes a different approach than the original PR).

* LayoutTests/platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::initializeDecoders):

Canonical link: https://commits.webkit.org/310634@main

cf75cea

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@ntrrgc
ntrrgc requested a review from philn as a code owner April 2, 2026 13:02
@ntrrgc ntrrgc self-assigned this Apr 2, 2026
@ntrrgc ntrrgc added the WebKitGTK Bugs related to the Gtk API layer. label Apr 2, 2026
m_decoderCodecMap.add("mp4a.40.29"_s, result); // MPEG-4 HE-AAC v2 (AAC LC + SBR + PS)
// As of writing, support for Extended HE-AAC (MPEG-D USAC) and xHE-AAC (MPEG-D USAC + MPEG-D DRC) -- which uses the
// USAC AOT, is not yet widely available enough to be enabled by default.
auto value = CStringView::unsafeFromUTF8(g_getenv("WEBKIT_CAN_PLAY_USAC"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename the env var to WEBKIT_GST_CAN_PLAY_USAC please? We use the WEBKIT_GST_ prefix usually.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 2, 2026
@ntrrgc ntrrgc removed the merging-blocked Applied to prevent a change from being merged label Apr 2, 2026
@ntrrgc
ntrrgc force-pushed the pr-2026-04-02-aac-aots branch from 3457eba to 88dd801 Compare April 2, 2026 14:02
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 2, 2026
@ntrrgc

ntrrgc commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported.html requires a rebaseline for the GStreamer ports, which is reasonable. We're now catching invalid codec strings, which we didn't before:

+PASS Test invalid codec ID "audio/mp4;codecs="mp4a""
+PASS Test invalid codec ID "audio/mp4;codecs="mp4a.40""
+PASS Test invalid codec ID "audio/mp4;codecs="mp4a.40.""
+PASS Test invalid codec ID "audio/mp4;codecs="mp4a.67.3""

@ntrrgc ntrrgc removed the merging-blocked Applied to prevent a change from being merged label Apr 2, 2026
@ntrrgc
ntrrgc force-pushed the pr-2026-04-02-aac-aots branch from 88dd801 to cf75cea Compare April 2, 2026 14:54
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 2, 2026
@ntrrgc ntrrgc added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Apr 6, 2026
https://bugs.webkit.org/show_bug.cgi?id=311347

Reviewed by Philippe Normand.

Currently the GStreamer ports of WebKit report support to any codec
string starting with "mp4a" if there is a decoder that supports
audio/mpeg, mpegversion=4. This is too optimistic and can lead to
applications choosing to use newer MPEG-4 Audio codecs not yet
supported by the user's system.

This patch makes WebKit play it safer and instead only report support
for AOTs with widespread support.

This includes reporting AOT 42 (typically used with xHE-AAC) as not
supported. Ideally we would query support for it somehow and reply
accordingly, but that would necessitate decoders to provide a uniform
API for querying such support, which unfortunately does not exist (and
would be tricky in practice as support is not always binary). An
environment variable is provided to declare explicit support or lack
thereof in environments where this is well-known, as well as for
debugging and experimentation.

See: WebPlatformForEmbedded/WPEWebKit#1641 (but
note that this patch takes a different approach than the original PR).

* LayoutTests/platform/glib/imported/w3c/web-platform-tests/media-source/mediasource-is-type-supported-expected.txt:
* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::initializeDecoders):

Canonical link: https://commits.webkit.org/310634@main
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 310634@main (e33ca76): https://commits.webkit.org/310634@main

Reviewed commits have been landed. Closing PR #61915 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit e33ca76 into WebKit:main Apr 6, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 6, 2026
@aperezdc aperezdc added the GLib Suggested Backport - 2.52 Suggest this merge request be backported to the webkitglib/2.52 stable branch label Apr 7, 2026
@aperezdc

aperezdc commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Backported into webkitglib/2.52 as commit 9526ecd

@aperezdc aperezdc removed the GLib Suggested Backport - 2.52 Suggest this merge request be backported to the webkitglib/2.52 stable branch label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKitGTK Bugs related to the Gtk API layer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants