Bug 1223696. Don't destroy VideoFrameContainer when we reach MetadataLoaded without a video track. r=jwwang

This commit is contained in:
Robert O'Callahan 2015-11-17 16:34:28 +13:00
parent cc670cd8bf
commit ff7c050be0
4 changed files with 51 additions and 9 deletions

View File

@ -28,6 +28,7 @@ CaptureStreamTestHelper.prototype = {
blackTransparent: { data: [0, 0, 0, 0], name: "blackTransparent" },
green: { data: [0, 255, 0, 255], name: "green" },
red: { data: [255, 0, 0, 255], name: "red" },
grey: { data: [128, 128, 128, 255], name: "grey" },
/* Default element size for createAndAppendElement() */
elemWidth: 100,

View File

@ -3428,15 +3428,7 @@ void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
#endif // MOZ_EME
}
// If this element had a video track, but consists only of an audio track now,
// delete the VideoFrameContainer. This happens when the src is changed to an
// audio only file.
// Else update its dimensions.
if (!aInfo->HasVideo()) {
ResetState();
} else {
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateReadyStateInternal);
}
mWatchManager.ManualNotify(&HTMLMediaElement::UpdateReadyStateInternal);
if (IsVideo() && aInfo->HasVideo()) {
// We are a video element playing video so update the screen wakelock

View File

@ -49,6 +49,7 @@ skip-if = buildapp == 'b2g' || toolkit == 'android' # no windowshare on b2g/andr
skip-if = buildapp == 'b2g' || toolkit == 'android' # no windowshare on b2g/android # Bug 1141029 Mulet parity with B2G Desktop for TC
[test_getUserMedia_basicVideoAudio.html]
skip-if = (toolkit == 'gonk' || buildapp == 'mulet' && debug) # debug-only failure, turned an intermittent (bug 962579) into a permanant orange
[test_getUserMedia_bug1223696.html]
[test_getUserMedia_constraints.html]
[test_getUserMedia_callbacks.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # Bug 1063290, intermittent timeout # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
"use strict";
createHTML({
title: "Testing that removeTrack+addTrack of video tracks still render the correct track in a media element",
bug: "1223696",
visible: true
});
runTest(() => Promise.resolve()
.then(() => getUserMedia({audio:true, video: true})).then(stream => {
info("Test addTrack()ing a video track to an audio-only gUM stream");
var video = createMediaElement("video", "test_video_track");
video.srcObject = stream;
video.play();
var h = new CaptureStreamTestHelper2D();
stream.removeTrack(stream.getVideoTracks()[0]);
video.onloadeddata = () => {
info("loadeddata");
var canvas = document.createElement("canvas");
canvas.getContext("2d");
var canvasStream = canvas.captureStream();
setInterval(() => h.drawColor(canvas, h.grey), 1000);
stream.addTrack(canvasStream.getVideoTracks()[0]);
checkMediaStreamContains(stream, [stream.getAudioTracks()[0],
canvasStream.getVideoTracks()[0]]);
};
return listenUntil(video, "loadeddata", () => true)
.then(() => h.waitForPixelColor(video, h.grey, 5,
"The canvas track should be rendered by the media element"));
}));
</script>
</pre>
</body>
</html>