-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REGRESSION (Safari 17 beta): [MSE] Can no longer play .FLAC inside MP4
https://bugs.webkit.org/show_bug.cgi?id=260491 rdar://114276660 Reviewed by Eric Carlson. In iOS 17 and macOS Sonoma, -[AVURLAsset isPlayableExtendedMIMEType:] is much more restrictive when reporting which codec types are supported. Previously, any CoreMedia FourCC code was listed as playable when paired with an ISO BMFF container type such as "video/mp4". Now, only those codec strings listed with the MP4 registration authority are considered valid. Since the official MP4RA string for the Flac audio codec is "fLaC", this means that whereas `audio/mp4; codecs="flac"` would previously succeed, those queries will now fail. While it is technically "correct" to reject the "flac" codec string when paired with ISO BMFF, there are a number of pages which are currently broken due to this change, so transform "flac" to "fLaC" at the WebCore layer. Additionally, while MIME container types are case-insensitive, the codec parameters on those container types are case-sensitive, so every Hash container where WebKit caches media MIME types must be changed from ASCIICaseInsensitiveHash to the default StringHash. This prevents both false positives and false negatives if the correct or incorrectly-cased versions are queried first. * LayoutTests/media/media-can-play-case-sensitive-flac-expected.txt: Added. * LayoutTests/media/media-can-play-case-sensitive-flac.html: Added. * LayoutTests/media/media-can-play-type-case-sensitive-expected.txt: Added. * LayoutTests/media/media-can-play-type-case-sensitive.html: Added. * Source/WebCore/platform/MIMETypeRegistry.cpp: (WebCore::MIMETypeRegistry::supportedMediaMIMETypes): * Source/WebCore/platform/MIMETypeRegistry.h: * Source/WebCore/platform/graphics/MIMETypeCache.cpp: (WebCore::MIMETypeCache::supportedTypes): (WebCore::MIMETypeCache::canDecodeType): (WebCore::MIMETypeCache::addSupportedTypes): (WebCore::MIMETypeCache::initializeCache): * Source/WebCore/platform/graphics/MIMETypeCache.h: * Source/WebCore/platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::getSupportedTypes): * Source/WebCore/platform/graphics/MediaPlayer.h: * Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList): * Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: * Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h: * Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm: (WebCore::AVAssetMIMETypeCache::canDecodeExtendedType): (WebCore::AVAssetMIMETypeCache::initializeCache): * Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h: * Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm: (WebCore::AVStreamDataParserMIMETypeCache::supportedTypes): (WebCore::AVStreamDataParserMIMETypeCache::initializeCache): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes): * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::getSupportedTypes): * Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.h: * Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm: (WebCore::mimeTypeCache): (WebCore::MediaPlayerPrivateWebM::getSupportedTypes): * Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: (WebCore::mimeTypeCache): (WebCore::MockMediaPlayerMediaSource::getSupportedTypes): * Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h: * Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp: (WebKit::RemoteMediaPlayerManagerProxy::getSupportedTypes): * Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp: (WebKit::RemoteMediaPlayerMIMETypeCache::supportedTypes): * Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.h: * Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp: (WebKit::RemoteMediaPlayerManager::getSupportedTypes): * Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h: * Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm: (createNSArray): Deleted. Canonical link: https://commits.webkit.org/267250@main
- Loading branch information
Showing
45 changed files
with
146 additions
and
83 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
LayoutTests/media/media-can-play-case-sensitive-flac-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Tests that both flac and fLaC are reported as playable in a mp4 container. | ||
EXPECTED (mediaElement.canPlayType('audio/mp4; codecs="flac"') == 'probably') OK | ||
EXPECTED (mediaElement.canPlayType('audio/mp4; codecs="fLaC"') == 'probably') OK | ||
EXPECTED (mediaElement.canPlayType('audio/mp4; codecs="FlAc"') == '') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>media-can-play-type-case-sensitive</title> | ||
<script src="video-test.js"></script> | ||
<script> | ||
window.addEventListener('load', event => { | ||
mediaElement = document.createElement('video'); | ||
testExpected(`mediaElement.canPlayType('audio/mp4; codecs="flac"')`, 'probably'); | ||
testExpected(`mediaElement.canPlayType('audio/mp4; codecs="fLaC"')`, 'probably'); | ||
testExpected(`mediaElement.canPlayType('audio/mp4; codecs="FlAc"')`, ''); | ||
endTest(); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div>Tests that both <code>flac</code> and <code>fLaC</code> are reported as playable in a mp4 container.</div> | ||
</body> | ||
</html> |
9 changes: 9 additions & 0 deletions
9
LayoutTests/media/media-can-play-type-case-sensitive-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Tests that subsequent tests of incorrectly cased codecs do not incorrectly report they are supported | ||
RUN(mediaElement.canPlayType('audio/mp4; codecs="fLaC"')) | ||
EXPECTED (mediaElement.canPlayType('audio/mp4; codecs="FlAc"') == '') OK | ||
RUN(mediaElement.canPlayType('video/mp4; codecs="avc1"')) | ||
EXPECTED (mediaElement.canPlayType('video/mp4; codecs="AvC1"') == '') OK | ||
RUN(mediaElement.canPlayType('video/ogg; codecs="vorbis"')) | ||
EXPECTED (mediaElement.canPlayType('video/ogg; codecs="vOrBiS"') == '') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>media-can-play-type-case-sensitive</title> | ||
<script src="video-test.js"></script> | ||
<script> | ||
window.addEventListener('load', event => { | ||
mediaElement = document.createElement('video'); | ||
run(`mediaElement.canPlayType('audio/mp4; codecs="fLaC"')`); | ||
testExpected(`mediaElement.canPlayType('audio/mp4; codecs="FlAc"')`, ''); | ||
run(`mediaElement.canPlayType('video/mp4; codecs="avc1"')`); | ||
testExpected(`mediaElement.canPlayType('video/mp4; codecs="AvC1"')`, ''); | ||
run(`mediaElement.canPlayType('video/ogg; codecs="vorbis"')`); | ||
testExpected(`mediaElement.canPlayType('video/ogg; codecs="vOrBiS"')`, ''); | ||
endTest(); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div>Tests that subsequent tests of incorrectly cased codecs do not incorrectly report they are supported</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.