Skip to content

Commit

Permalink
Bug 1849271 - Flip test when checking for the presence of optional co…
Browse files Browse the repository at this point in the history
…lorspace members on a VideoDecoderConfig. r=media-playback-reviewers,alwu

Differential Revision: https://phabricator.services.mozilla.com/D186530
  • Loading branch information
padenot committed Aug 22, 2023
1 parent a8d0e26 commit 001148d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc-test-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ const extraMochitestTestPaths = [
"dom/media/mediasource/test/",
"dom/media/test/",
"dom/media/webcodecs/test/",
"dom/media/webcodecs/crashtests/",
"dom/media/webspeech/recognition/test/",
"dom/media/webspeech/synth/test/",
"dom/messagechannel/tests/",
Expand Down
8 changes: 4 additions & 4 deletions dom/media/webcodecs/VideoDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,16 @@ static Result<UniquePtr<TrackInfo>, nsresult> CreateVideoInfo(

if (aConfig.mColorSpace.isSome()) {
const VideoColorSpaceInternal& colorSpace(aConfig.mColorSpace.value());
if (!colorSpace.mFullRange.isSome()) {
if (colorSpace.mFullRange.isSome()) {
vi->mColorRange = ToColorRange(colorSpace.mFullRange.value());
}
if (!colorSpace.mMatrix.isSome()) {
if (colorSpace.mMatrix.isSome()) {
vi->mColorSpace.emplace(ToColorSpace(colorSpace.mMatrix.value()));
}
if (!colorSpace.mPrimaries.isSome()) {
if (colorSpace.mPrimaries.isSome()) {
vi->mColorPrimaries.emplace(ToPrimaries(colorSpace.mPrimaries.value()));
}
if (!colorSpace.mTransfer.isSome()) {
if (colorSpace.mTransfer.isSome()) {
vi->mTransferFunction.emplace(
ToTransferFunction(colorSpace.mTransfer.value()));
}
Expand Down
27 changes: 27 additions & 0 deletions dom/media/webcodecs/crashtest/1849271.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<html class="reftest-wait">
<script>
var cfg = {
codec: "vp8",
colorSpace: { primaries: "bt709" },
};
var decoder = new VideoDecoder({
output: () => {},
error: e => {
document.documentElement.removeAttribute("class");
},
});
decoder.configure(cfg);
try {
decoder.decode(
new EncodedVideoChunk({
type: "key",
timestamp: 0,
duration: 10,
data: new Uint8Array(10),
})
);
} catch (e) {
document.documentElement.removeAttribute("class");
}
</script>
</html>
7 changes: 7 additions & 0 deletions dom/media/webcodecs/crashtest/crashtests.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[DEFAULT]
subsuite = media
tags = webcodecs
prefs =
dom.media.webcodecs.enabled=true

load 1849271.html
1 change: 1 addition & 0 deletions dom/media/webcodecs/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ with Files("*"):
BUG_COMPONENT = ("Core", "Audio/Video: Web Codecs")

MOCHITEST_MANIFESTS += ["test/mochitest.ini"]
CRASHTEST_MANIFESTS += ["crashtest/crashtests.list"]

# For mozilla/layers/ImageBridgeChild.h
LOCAL_INCLUDES += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ module.exports = {
AudioBuffer: false,
AudioBufferSourceNode: false,
AudioContext: false,
AudioDecoder: false,
AudioDestinationNode: false,
AudioData: false,
AudioEncoder: false,
AudioListener: false,
AudioNode: false,
AudioParam: false,
Expand Down Expand Up @@ -162,6 +165,8 @@ module.exports = {
DragEvent: false,
DynamicsCompressorNode: false,
Element: false,
EncodedAudioChunk: false,
EncodedVideoChunk: false,
ErrorEvent: false,
Event: false,
EventSource: false,
Expand Down Expand Up @@ -704,6 +709,10 @@ module.exports = {
VTTCue: false,
VTTRegion: false,
ValidityState: false,
VideoColorSpace: false,
VideoDecoder: false,
VideoEncoder: false,
VideoFrame: false,
VideoPlaybackQuality: false,
VideoTrack: false,
VideoTrackList: false,
Expand Down

0 comments on commit 001148d

Please sign in to comment.