Skip to content

[EME] Check support for full content type string (including codecs)#1643

Open
asurdej-comcast wants to merge 1 commit intoWebPlatformForEmbedded:wpe-2.46from
asurdej-comcast:eme_suports_type
Open

[EME] Check support for full content type string (including codecs)#1643
asurdej-comcast wants to merge 1 commit intoWebPlatformForEmbedded:wpe-2.46from
asurdej-comcast:eme_suports_type

Conversation

@asurdej-comcast
Copy link
Copy Markdown

@asurdej-comcast asurdej-comcast commented Mar 20, 2026

When evaluating media capability support in EME::requestMediaKeySystemAccess(), MediaPlayer::supportsType() was called with only the container MIME type (e.g. 'video/mp4'), stripping codecs and other parameters.

Pass the full content type string (e.g. 'video/mp4; codecs="avc1.42E01E"') so the media engine can properly validate codec support, not just the container.
391b3c3

Build-Tests Layout-Tests
✅ 🛠 wpe-246-amd64-build ✅ 🧪 wpe-246-amd64-layout
✅ 🛠 wpe-246-arm32-build ✅ 🧪 wpe-246-arm32-layout

When evaluating media capability support in EME::requestMediaKeySystemAccess(),
MediaPlayer::supportsType() was called with only the container MIME type
(e.g. 'video/mp4'), stripping codecs and other parameters.

Pass the full content type string (e.g. 'video/mp4; codecs="avc1.42E01E"')
so the media engine can properly validate codec support, not just the container.
@asurdej-comcast
Copy link
Copy Markdown
Author

We received a test app from Dolby that queries support for dolby types from different JS APIs (isTypeSupported, MediaCapabilites, EME). With current implementation, EME will check only the mime type of original content type string. This ignores all parameters, including codecs.
According to spec comment

        // 3.13. If the user agent and implementation definitely support playback of encrypted media data for the
        //       combination of container, media types, robustness and local accumulated configuration in combination
        //       with restrictions:

"media types" here refers directly to codecs:

        // 3.9. Let media types be the set of codecs and codec constraints specified by parameters. The case-sensitivity
        //      of string comparisons is determined by the appropriate RFC or other specification.

In that sense it's reasonable to check full content type string instead of mime type only.

Checking the history of that impl shows that "codecs" was part of inital impl in 79099b3 (but was ignored by MediaPlayer at that time).
Then it was merged with mimeType into ContentType param in f73bc7e
and dropped eventually with e001f66

@modeveci modeveci requested a review from vivienne-w March 20, 2026 11:59
vivienne-w added a commit to vivienne-w/WebKit that referenced this pull request Mar 25, 2026
https://bugs.webkit.org/show_bug.cgi?id=310709

Reviewed by NOBODY (OOPS!).

When evaluating media capabilities for requestMediaKeySystemAccess,
we use pass ParsedContentType's m_mimeType to the MediaSource,
which omits parameters of the MIME type like codecs.

The right field to use here is m_contentType, so MediaSource
can check support against the full MIME type, rather than just
its container type.

* Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp:
(WebCore::CDMPrivate::getSupportedCapabilitiesForAudioVideoType):
* Source/WebCore/platform/network/ParsedContentType.h:
(WebCore::ParsedContentType::contentType const): Added, returns m_contentType.

Original author: Andrzej Surdej <Andrzej_Surdej@comcast.com>
See: WebPlatformForEmbedded/WPEWebKit#1643
@vivienne-w vivienne-w added the upstream Related to an upstream bug (or should be at some point) label Mar 25, 2026
vivienne-w added a commit to vivienne-w/WebKit that referenced this pull request Mar 26, 2026
https://bugs.webkit.org/show_bug.cgi?id=310709

Reviewed by NOBODY (OOPS!).

When evaluating media capabilities for requestMediaKeySystemAccess,
we use pass ParsedContentType's m_mimeType to the MediaSource,
which omits parameters of the MIME type like codecs.

The right field to use here is m_contentType, so MediaSource
can check support against the full MIME type, rather than just
its container type.

* LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess-expected.txt:
* LayoutTests/media/encrypted-media/mock-navigator-requestMediaKeySystemAccess.html: Add test with supported type but unknown codec.
* LayoutTests/platform/glib/TestExpectations: Unflag mock-navigator-requestMediaKeySystemAccess.html.
* LayoutTests/platform/ios/TestExpectations: Ditto.
* LayoutTests/platform/mac/TestExpectations: Ditto.
* Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp:
(WebCore::CDMPrivate::getSupportedCapabilitiesForAudioVideoType): Use full contentType for MediaEngineSupportParameters.
* Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
(WebCore::MockMediaPlayerMediaSource::supportsType): Return NotSupported if codec is 'unknown' or 'invalid'.
* Source/WebCore/platform/network/ParsedContentType.h:
(WebCore::ParsedContentType::contentType const): Added, returns m_contentType.

Original author: Andrzej Surdej <Andrzej_Surdej@comcast.com>
See: WebPlatformForEmbedded/WPEWebKit#1643
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Related to an upstream bug (or should be at some point) wpe-2.46

Development

Successfully merging this pull request may close these issues.

3 participants