Skip to content

[MSE][GStreamer] Advertise AC4 in systems supporting it - #61449

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
ntrrgc:eng/MSE-GStreamer-Advertise-AC4-in-systems-supporting-it
Apr 1, 2026
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
ntrrgc:eng/MSE-GStreamer-Advertise-AC4-in-systems-supporting-it

Conversation

@ntrrgc

@ntrrgc ntrrgc commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

b69bf01

[MSE][GStreamer] Advertise AC4 in systems supporting it
https://bugs.webkit.org/show_bug.cgi?id=310845

Reviewed by Xabier Rodriguez-Calvar.

This patch enables Dolby AC-4 support in systems that have a GStreamer
decoder that supports it.  As of writing AC-4 support is still not mature
in desktop but it is present in some set top boxes.

The changes involve adding support for the MIME type and codec strings
in MSE and whitelisting the caps in WebKitThunderDecryptorGStreamer. The
codec string is also checked for format correctness and presentation
version support.

Unfortunately, as of writing the existing GStreamer decoders don't have
a established way of querying AC-4 support levels in a fine grained
manner.

This patch will accept codec strings for presentation version 1.
Presentation version 1 is the minimum version supported by bitstream
version 2, which is the only bitstream version that is part of the
current Dolby AC-4 Kit (1.5) test signals. This combination is also the
only one supported in CMAF according to the current version of the AC-4
spec (ETSI TS 103 190-2 V1.3.1, 2025-07).

This is understood to be a reasonable baseline for what is commonly
supported for a contemporary AC-4 decoder. It is possible however that
in the future we need to add support for e.g. environment variables
to further customize support level, assuming that by then there is still
no way of querying the support level from WebKit.

Original author: Andrzej Surdej <[email protected]>
See: WebPlatformForEmbedded/WPEWebKit#1641

* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::initializeDecoders):
(WebCore::GStreamerRegistryScanner::isCodecSupported const):
(WebCore::parseAC4LevelAndProfile):
* Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderParser.cpp:

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

7126633

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 March 26, 2026 23:10
@ntrrgc ntrrgc self-assigned this Mar 26, 2026
@ntrrgc ntrrgc added the WebKitGTK Bugs related to the Gtk API layer. label Mar 26, 2026
@@ -49,6 +49,8 @@ namespace WebCore {
GST_DEBUG_CATEGORY_STATIC(webkit_media_gst_registry_scanner_debug);
#define GST_CAT_DEFAULT webkit_media_gst_registry_scanner_debug

static bool parseAc4LevelAndProfile(const String& codec);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: I would prefer to spell it as parseAC4...

GST_WARNING("AC-4 codec string has wrong number of components: %s", codec.utf8().data());
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The commit message says "presentation version 1 is the minimum version supported by bitstream version 2" and that bsv2 is the only one in the current Dolby kit. Yet the function never checks parts[1] (the bitstream_version). Should it reject bitstream_version != 2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

presentation_version=1 can still be carried by all three bitstream versions.

Image

Source: Table 51: bitstream_version, ETSI TS 103 190-2 v1.3.1 (2025-07)

In the table above [1] refers to the legacy AC-4 that uses presentation_version=1. «the present document» means presentation version 1 or 2 (See 6.3.2.3: presentation_version).

We could still try to be conservative and reject older bitstream versions, but I wouldn't risk it until we have some reason to.

Comment on lines +1058 to +1059
// mdcompat (level): only levels 0-3 are assumed supported.
// Levels 4-6 are reserved by the AC-4 spec. Level 7 (unlimited number of tracks) is assumed unsupported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The comment says "only levels 0–3 are assumed supported", but level 0 means "no metadata compatibility constraints". Is that genuinely something the decoders on these STBs handle, or should the minimum be 1?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

level 0 means "no metadata compatibility constraints"

Where did you read this? md_compat 0 would mean up to 2 streams of non-object audio. Unrestricted is 7.

image

Source: ETSI TS 103 190-2 V1.3.1 (2025-07) page 157

@ntrrgc
ntrrgc force-pushed the eng/MSE-GStreamer-Advertise-AC4-in-systems-supporting-it branch from 2b67169 to 7126633 Compare April 1, 2026 12:01
@ntrrgc ntrrgc added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Apr 1, 2026
@webkit-ews-buildbot webkit-ews-buildbot added merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Apr 1, 2026
@webkit-ews-buildbot

Copy link
Copy Markdown
Collaborator

Safe-Merge-Queue: Build #88356.

@webkit-commit-queue
webkit-commit-queue force-pushed the eng/MSE-GStreamer-Advertise-AC4-in-systems-supporting-it branch from 7126633 to c4013ea Compare April 1, 2026 19:28
https://bugs.webkit.org/show_bug.cgi?id=310845

Reviewed by Xabier Rodriguez-Calvar.

This patch enables Dolby AC-4 support in systems that have a GStreamer
decoder that supports it.  As of writing AC-4 support is still not mature
in desktop but it is present in some set top boxes.

The changes involve adding support for the MIME type and codec strings
in MSE and whitelisting the caps in WebKitThunderDecryptorGStreamer. The
codec string is also checked for format correctness and presentation
version support.

Unfortunately, as of writing the existing GStreamer decoders don't have
a established way of querying AC-4 support levels in a fine grained
manner.

This patch will accept codec strings for presentation version 1.
Presentation version 1 is the minimum version supported by bitstream
version 2, which is the only bitstream version that is part of the
current Dolby AC-4 Kit (1.5) test signals. This combination is also the
only one supported in CMAF according to the current version of the AC-4
spec (ETSI TS 103 190-2 V1.3.1, 2025-07).

This is understood to be a reasonable baseline for what is commonly
supported for a contemporary AC-4 decoder. It is possible however that
in the future we need to add support for e.g. environment variables
to further customize support level, assuming that by then there is still
no way of querying the support level from WebKit.

Original author: Andrzej Surdej <[email protected]>
See: WebPlatformForEmbedded/WPEWebKit#1641

* Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::initializeDecoders):
(WebCore::GStreamerRegistryScanner::isCodecSupported const):
(WebCore::parseAC4LevelAndProfile):
* Source/WebCore/platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderDecryptorGStreamer.cpp:
* Source/WebCore/platform/graphics/gstreamer/eme/WebKitThunderParser.cpp:

Canonical link: https://commits.webkit.org/310381@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/MSE-GStreamer-Advertise-AC4-in-systems-supporting-it branch from c4013ea to b69bf01 Compare April 1, 2026 19:30
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 310381@main (b69bf01): https://commits.webkit.org/310381@main

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

@webkit-commit-queue
webkit-commit-queue merged commit b69bf01 into WebKit:main Apr 1, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 1, 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.

5 participants