Commit 12eda0cc authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Fix broken MSE VP9 telemetry test.

Two issues are fixed:
- File was somehow muxed into an invalid configuration.
- Not enough was appended to start playback.

Also other tests were flaking, so:
- Increased append size to 128k
- Only start playback after appends complete.
- Mark EOS and add ended listener since append size is small.

BUG=978045
TEST=test passes

Change-Id: I25dc5994044424c53198490d89d3de15f6e5c616
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1680956
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarMatthew Wolenetz <wolenetz@chromium.org>
Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676165}
parent 613da8d3
...@@ -204,12 +204,6 @@ crbug.com/865400 [ Pixel2_Webview ] loading.mobile/OLX_3g [ Skip ] ...@@ -204,12 +204,6 @@ crbug.com/865400 [ Pixel2_Webview ] loading.mobile/OLX_3g [ Skip ]
crbug.com/865400 [ Pixel2_Webview ] loading.mobile/VoiceMemos_cold_3g [ Skip ] crbug.com/865400 [ Pixel2_Webview ] loading.mobile/VoiceMemos_cold_3g [ Skip ]
crbug.com/919191 [ Nexus5X_Webview ] loading.mobile/OLX_3g [ Skip ] crbug.com/919191 [ Nexus5X_Webview ] loading.mobile/OLX_3g [ Skip ]
# Benchmark: media.desktop
crbug.com/978045 [ All ] media.desktop/mse.html?media=tulip2.vp9.webm [ Skip ]
# Benchmark: media.mobile
crbug.com/978045 [ All ] media.mobile/mse.html?media=tulip2.vp9.webm [ Skip ]
# Benchmark: oilpan_gc_times.key_silk_cases # Benchmark: oilpan_gc_times.key_silk_cases
crbug.com/446332 [ All ] oilpan_gc_times.key_silk_cases/slide_drawer [ Skip ] crbug.com/446332 [ All ] oilpan_gc_times.key_silk_cases/slide_drawer [ Skip ]
crbug.com/507865 [ All ] oilpan_gc_times.key_silk_cases/polymer_topeka [ Skip ] crbug.com/507865 [ All ] oilpan_gc_times.key_silk_cases/polymer_topeka [ Skip ]
......
...@@ -309,7 +309,10 @@ def _GetCrossPlatformMediaPages(page_set): ...@@ -309,7 +309,10 @@ def _GetCrossPlatformMediaPages(page_set):
page_set=page_set, page_set=page_set,
tags=['vp9', 'opus', 'audio_video']), tags=['vp9', 'opus', 'audio_video']),
# Basic MSE test pages for common configurations. # Basic MSE test pages for common configurations. Note: By default the
# test will only append the first 128k of the specified files, so when
# adding tests ensure that is enough to trigger a timeupdate event. If not
# you'll need to specify an additional appendSize parameter.
_MSEPage( _MSEPage(
url=_URL_BASE + 'mse.html?media=aac_audio.mp4,h264_video.mp4', url=_URL_BASE + 'mse.html?media=aac_audio.mp4,h264_video.mp4',
page_set=page_set, page_set=page_set,
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
// Map from media content to MIME type. All test content must be added to this // Map from media content to MIME type. All test content must be added to this
// map. (Feel free to extend it for your test case!) // map. (Feel free to extend it for your test case!)
const MEDIA_MIMES = { const MEDIA_MIMES = {
"aac_audio.mp4": "audio/mp4; codecs=\"mp4a.40.2\"", 'aac_audio.mp4': 'audio/mp4; codecs="mp4a.40.2"',
"h264_video.mp4": "video/mp4; codecs=\"avc1.640028\"", 'h264_video.mp4': 'video/mp4; codecs="avc1.640028"',
"tulip0.av1.mp4": "video/mp4; codecs=\"av01.0.05M.08\"", 'tulip0.av1.mp4': 'video/mp4; codecs="av01.0.05M.08"',
"tulip2.vp9.webm": "video/webm; codecs=\"opus,vp9\"", 'tulip2.vp9.webm': 'video/webm; codecs="opus,vp9"',
}; };
const testParams = {} const testParams = {}
...@@ -33,16 +33,16 @@ ...@@ -33,16 +33,16 @@
// waitForPageLoaded determines whether to wait for body.onload event or // waitForPageLoaded determines whether to wait for body.onload event or
// to start right away. // to start right away.
testParams.waitForPageLoaded = testParams.waitForPageLoaded =
(queryParameters["waitForPageLoaded"] === "true"); (queryParameters['waitForPageLoaded'] === 'true');
// startOffset is used to start the media at an offset instead of at the // startOffset is used to start the media at an offset instead of at the
// beginning of the file. // beginning of the file.
testParams.startOffset = parseInt(queryParameters["startOffset"] || "0"); testParams.startOffset = parseInt(queryParameters['startOffset'] || '0');
// appendSize determines how large a chuck of the media file to append. // appendSize determines how large a chunk of the media file to append.
testParams.appendSize = parseInt(queryParameters["appendSize"] || "65536"); testParams.appendSize = parseInt(queryParameters['appendSize'] || '128000');
// media argument lists the media files to play. // media argument lists the media files to play.
testParams.media = queryParameters["media"]; testParams.media = queryParameters['media'];
if (!testParams.media) if (!testParams.media)
throw Error("media parameter must be defined to provide test content"); throw Error('media parameter must be defined to provide test content');
if (!Array.isArray(testParams.media)) if (!Array.isArray(testParams.media))
testParams.media = [testParams.media]; testParams.media = [testParams.media];
} }
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
key = decodeURIComponent(match[1]) key = decodeURIComponent(match[1])
value = decodeURIComponent(match[2]); value = decodeURIComponent(match[2]);
if (value.includes(',')) { if (value.includes(',')) {
value = value.split(","); value = value.split(',');
} }
params[key] = value; params[key] = value;
} }
...@@ -64,21 +64,31 @@ ...@@ -64,21 +64,31 @@
function runTest() { function runTest() {
let appenders = []; let appenders = [];
let mediaElement = document.getElementById("video_id"); let mediaElement = document.getElementById('video_id');
let mediaSource = new window.MediaSource(); let mediaSource = new window.MediaSource();
window.__mediaSource = mediaSource; window.__mediaSource = mediaSource;
// Pass the test if currentTime of the media increases since that means that // Pass the test if currentTime of the media increases since that means that
// the file has started playing. // the file has started playing.
// This code can be modified in the future for full playback tests. // This code can be modified in the future for full playback tests.
mediaElement.addEventListener("timeupdate", () => { mediaElement.addEventListener('timeupdate', () => {
window.clearTimeout(timeout); window.clearTimeout(timeout);
PassTest("Test completed after timeupdate event was received.") PassTest('Test completed after timeupdate event was received.')
}, {once: true});
// Also pass the test if ended occurs; since we're appending small chunks
// there are cases where 'timeupdate' may not necessarily fire.
mediaElement.addEventListener('ended', () => {
window.clearTimeout(timeout);
if (mediaElement.currentTime > 0)
PassTest('Test completed after ended event was received.')
else
FailTest('Test failed because ended occured before currentTime > 0.')
}, {once: true}); }, {once: true});
// Fail the test if we time out. // Fail the test if we time out.
var timeout = setTimeout(function() { var timeout = setTimeout(function() {
FailTest("Test timed out waiting for a mediaElement timeupdate event."); FailTest('Test timed out waiting for a timeupdate or ended event.');
}, 10000); }, 10000);
mediaSource.addEventListener('sourceopen', (open_event) => { mediaSource.addEventListener('sourceopen', (open_event) => {
...@@ -86,10 +96,18 @@ ...@@ -86,10 +96,18 @@
for (let i = 0; i < appenders.length; ++i) { for (let i = 0; i < appenders.length; ++i) {
appenders[i].onSourceOpen(mediaSource); appenders[i].onSourceOpen(mediaSource);
} }
// Append each segment and wait for the append to complete.
let num_complete_appends = 0;
for (let i = 0; i < appenders.length; ++i) { for (let i = 0; i < appenders.length; ++i) {
appenders[i].attemptAppend(mediaSource); appenders[i].attemptAppend(() => {
num_complete_appends++;
if (num_complete_appends === testParams.media.length) {
mediaSource.endOfStream();
mediaElement.play();
}
});
} }
mediaElement.play();
}); });
// Do not attach MediaSource object until all the buffer appenders have // Do not attach MediaSource object until all the buffer appenders have
...@@ -120,7 +138,7 @@ ...@@ -120,7 +138,7 @@
this.sourceBuffer = null; this.sourceBuffer = null;
} }
requestMediaBytes(callback) { requestMediaBytes(callback) {
this.xhr.addEventListener('loadend', callback); this.xhr.addEventListener('loadend', callback, {once: true});
this.xhr.open('GET', this.media_file); this.xhr.open('GET', this.media_file);
this.xhr.setRequestHeader( this.xhr.setRequestHeader(
'Range', 'bytes=' + testParams.startOffset + '-' + 'Range', 'bytes=' + testParams.startOffset + '-' +
...@@ -133,21 +151,22 @@ ...@@ -133,21 +151,22 @@
return; return;
this.sourceBuffer = mediaSource.addSourceBuffer(this.mimetype); this.sourceBuffer = mediaSource.addSourceBuffer(this.mimetype);
} }
attemptAppend() { attemptAppend(callback) {
if (!this.xhr.response || !this.sourceBuffer) if (!this.xhr.response || !this.sourceBuffer)
return; return;
this.sourceBuffer.addEventListener('updateend', callback, {once: true});
this.sourceBuffer.appendBuffer(this.xhr.response); this.sourceBuffer.appendBuffer(this.xhr.response);
this.xhr = null; this.xhr = null;
} }
} // End BufferAppender } // End BufferAppender
function PassTest(message) { function PassTest(message) {
console.log("Test passed: " + message); console.log('Test passed: ' + message);
window.__testDone = true; window.__testDone = true;
} }
function FailTest(error_message) { function FailTest(error_message) {
console.error("Test failed: " + error_message); console.error('Test failed: ' + error_message);
window.__testFailed = true; window.__testFailed = true;
window.__testError = error_message; window.__testError = error_message;
window.__testDone = true; window.__testDone = true;
...@@ -163,5 +182,5 @@ ...@@ -163,5 +182,5 @@
// These are outputs to be consumed by media Telemetry test driver code. // These are outputs to be consumed by media Telemetry test driver code.
window.__testDone = false; window.__testDone = false;
window.__testFailed = false; window.__testFailed = false;
window.__testError = ""; window.__testError = '';
})(); })();
ed72683c4dcea40bf452b64cb42d54fbdcb1c169 bfb14ee1e08d13c795d20d6ede452255009d5e91
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment