summaryrefslogtreecommitdiffstats
path: root/dom/media/test/dash
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dom/media/test/dash/dash-manifest-garbled-webm.mpd35
-rw-r--r--dom/media/test/dash/dash-manifest-garbled.mpd1
-rw-r--r--dom/media/test/dash/dash-manifest-sjs.mpd35
-rw-r--r--dom/media/test/dash/dash-manifest.mpd35
-rw-r--r--dom/media/test/dash/dash-webm-audio-128k.webmbin0 -> 41946 bytes
-rw-r--r--dom/media/test/dash/dash-webm-video-320x180.webmbin0 -> 35123 bytes
-rw-r--r--dom/media/test/dash/dash-webm-video-428x240.webmbin0 -> 50206 bytes
-rw-r--r--dom/media/test/dash/garbled.webm1
-rw-r--r--dom/media/test/dash_detect_stream_switch.sjs143
9 files changed, 250 insertions, 0 deletions
diff --git a/dom/media/test/dash/dash-manifest-garbled-webm.mpd b/dom/media/test/dash/dash-manifest-garbled-webm.mpd
new file mode 100644
index 0000000000..aa78ded3ec
--- /dev/null
+++ b/dom/media/test/dash/dash-manifest-garbled-webm.mpd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MPD
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:mpeg:DASH:schema:MPD:2011"
+ xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011"
+ type="static"
+ mediaPresentationDuration="PT3.958S"
+ minBufferTime="PT1S"
+ profiles="urn:webm:dash:profile:webm-on-demand:2012">
+ <BaseURL>./</BaseURL>
+ <Period id="0" start="PT0S" duration="PT3.958S" >
+ <AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
+ <Representation id="0" bandwidth="54207" width="320" height="180">
+ <BaseURL>garbled.webm</BaseURL>
+ <SegmentBase indexRange="35090-35123">
+ <Initialization range="0-228" />
+ </SegmentBase>
+ </Representation>
+ <Representation id="1" bandwidth="78006" width="428" height="240">
+ <BaseURL>dash-webm-video-428x240.webm</BaseURL>
+ <SegmentBase indexRange="50173-50206">
+ <Initialization range="0-228" />
+ </SegmentBase>
+ </Representation>
+ </AdaptationSet>
+ <AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="48000" subsegmentStartsWithSAP="1">
+ <Representation id="2" bandwidth="57264">
+ <BaseURL>dash-webm-audio-128k.webm</BaseURL>
+ <SegmentBase indexRange="41927-41946">
+ <Initialization range="0-4521" />
+ </SegmentBase>
+ </Representation>
+ </AdaptationSet>
+ </Period>
+</MPD>
diff --git a/dom/media/test/dash/dash-manifest-garbled.mpd b/dom/media/test/dash/dash-manifest-garbled.mpd
new file mode 100644
index 0000000000..ac8eadbddc
--- /dev/null
+++ b/dom/media/test/dash/dash-manifest-garbled.mpd
@@ -0,0 +1 @@
+PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxNUEQgbWVkaWFQcmVzZW50YXRpb25EdXJhdGlvbj0iUFQxOS41MVMiIG1pbkJ1ZmZlclRpbWU9IlBUMVMiIHByb2ZpbGVzPSJ1cm46d2VibTpkYXNoOnByb2ZpbGU6d2VibS1vbi1kZW1hbmQ6MjAxMiIgdHlwZT0ic3RhdGljIiB4bWxucz0idXJuOm1wZWc6REFTSDpzY2hlbWE6TVBEOjIwMTEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTpzY2hlbWFMb2NhdGlvbj0idXJuOm1wZWc6REFTSDpzY2hlbWE6TVBEOjIwMTEiPjxCYXNlVVJMPmh0dHA6Ly93d3cuZ29vZ2xlLmNvbTwvQmFzZVVSTD48UGVyaW9kIGR1cmF0aW9uPSJQVDE5LjUxUyIgaWQ9IjAiIHN0YXJ0PSJQVDBTIj48QWRhcHRhdGlvblNldCBhdWRpb1NhbXBsaW5nUmF0ZT0iNDgwMDAiIGNvZGVjcz0idm9yYmlzIiBpZD0iMSIgbGFuZz0iZW5nIiBtaW1lVHlwZT0iYXVkaW8vd2VibSIgc3Vic2VnbWVudFN0YXJ0c1dpdGhTQVA9IjEiPjxSZXByZXNlbnRhdGlvbiBiYW5kd2lkdGg9IjIwMTA5IiBpZD0iMiI+PEJhc2VVUkwvPjxTZWdtZW50QmFzZSBpbmRleFJhbmdlPSIzMTk3ODAtMzIwNjEyIj48SW5pdGlhbGl6YXRpb24gcmFuZ2U9IjAtMjA4NzAiLz48L1NlZ21lbnRCYXNlPjwvUmVwcmVzZW50YXRpb24+PC9BZGFwdGF0aW9uU2V0PjwvUGVyaW9kPjwvTVBEPg
diff --git a/dom/media/test/dash/dash-manifest-sjs.mpd b/dom/media/test/dash/dash-manifest-sjs.mpd
new file mode 100644
index 0000000000..c7ecba3c69
--- /dev/null
+++ b/dom/media/test/dash/dash-manifest-sjs.mpd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MPD
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:mpeg:DASH:schema:MPD:2011"
+ xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011"
+ type="static"
+ mediaPresentationDuration="PT3.958S"
+ minBufferTime="PT1S"
+ profiles="urn:webm:dash:profile:webm-on-demand:2012">
+ <BaseURL>./dash_detect_stream_switch.sjs?name=</BaseURL>
+ <Period id="0" start="PT0S" duration="PT3.958S" >
+ <AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
+ <Representation id="0" bandwidth="54207" width="320" height="180">
+ <BaseURL>dash-webm-video-320x180.webm</BaseURL>
+ <SegmentBase indexRange="35090-35123">
+ <Initialization range="0-228" />
+ </SegmentBase>
+ </Representation>
+ <Representation id="1" bandwidth="78006" width="428" height="240">
+ <BaseURL>dash-webm-video-428x240.webm</BaseURL>
+ <SegmentBase indexRange="50173-50206">
+ <Initialization range="0-228" />
+ </SegmentBase>
+ </Representation>
+ </AdaptationSet>
+ <AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="48000" subsegmentStartsWithSAP="1">
+ <Representation id="2" bandwidth="57264">
+ <BaseURL>dash-webm-audio-128k.webm</BaseURL>
+ <SegmentBase indexRange="41927-41946">
+ <Initialization range="0-4521" />
+ </SegmentBase>
+ </Representation>
+ </AdaptationSet>
+ </Period>
+</MPD>
diff --git a/dom/media/test/dash/dash-manifest.mpd b/dom/media/test/dash/dash-manifest.mpd
new file mode 100644
index 0000000000..98c7a90480
--- /dev/null
+++ b/dom/media/test/dash/dash-manifest.mpd
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MPD
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:mpeg:DASH:schema:MPD:2011"
+ xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011"
+ type="static"
+ mediaPresentationDuration="PT3.958S"
+ minBufferTime="PT1S"
+ profiles="urn:webm:dash:profile:webm-on-demand:2012">
+ <BaseURL>./</BaseURL>
+ <Period id="0" start="PT0S" duration="PT3.958S" >
+ <AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
+ <Representation id="0" bandwidth="54207" width="320" height="180">
+ <BaseURL>dash-webm-video-320x180.webm</BaseURL>
+ <SegmentBase indexRange="35090-35123">
+ <Initialization range="0-228" />
+ </SegmentBase>
+ </Representation>
+ <Representation id="1" bandwidth="78006" width="428" height="240">
+ <BaseURL>dash-webm-video-428x240.webm</BaseURL>
+ <SegmentBase indexRange="50173-50206">
+ <Initialization range="0-228" />
+ </SegmentBase>
+ </Representation>
+ </AdaptationSet>
+ <AdaptationSet id="1" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="48000" subsegmentStartsWithSAP="1">
+ <Representation id="2" bandwidth="57264">
+ <BaseURL>dash-webm-audio-128k.webm</BaseURL>
+ <SegmentBase indexRange="41927-41946">
+ <Initialization range="0-4521" />
+ </SegmentBase>
+ </Representation>
+ </AdaptationSet>
+ </Period>
+</MPD>
diff --git a/dom/media/test/dash/dash-webm-audio-128k.webm b/dom/media/test/dash/dash-webm-audio-128k.webm
new file mode 100644
index 0000000000..f56c042053
--- /dev/null
+++ b/dom/media/test/dash/dash-webm-audio-128k.webm
Binary files differ
diff --git a/dom/media/test/dash/dash-webm-video-320x180.webm b/dom/media/test/dash/dash-webm-video-320x180.webm
new file mode 100644
index 0000000000..282e6a2cc3
--- /dev/null
+++ b/dom/media/test/dash/dash-webm-video-320x180.webm
Binary files differ
diff --git a/dom/media/test/dash/dash-webm-video-428x240.webm b/dom/media/test/dash/dash-webm-video-428x240.webm
new file mode 100644
index 0000000000..23f2c89616
--- /dev/null
+++ b/dom/media/test/dash/dash-webm-video-428x240.webm
Binary files differ
diff --git a/dom/media/test/dash/garbled.webm b/dom/media/test/dash/garbled.webm
new file mode 100644
index 0000000000..ac8eadbddc
--- /dev/null
+++ b/dom/media/test/dash/garbled.webm
@@ -0,0 +1 @@
+PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxNUEQgbWVkaWFQcmVzZW50YXRpb25EdXJhdGlvbj0iUFQxOS41MVMiIG1pbkJ1ZmZlclRpbWU9IlBUMVMiIHByb2ZpbGVzPSJ1cm46d2VibTpkYXNoOnByb2ZpbGU6d2VibS1vbi1kZW1hbmQ6MjAxMiIgdHlwZT0ic3RhdGljIiB4bWxucz0idXJuOm1wZWc6REFTSDpzY2hlbWE6TVBEOjIwMTEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTpzY2hlbWFMb2NhdGlvbj0idXJuOm1wZWc6REFTSDpzY2hlbWE6TVBEOjIwMTEiPjxCYXNlVVJMPmh0dHA6Ly93d3cuZ29vZ2xlLmNvbTwvQmFzZVVSTD48UGVyaW9kIGR1cmF0aW9uPSJQVDE5LjUxUyIgaWQ9IjAiIHN0YXJ0PSJQVDBTIj48QWRhcHRhdGlvblNldCBhdWRpb1NhbXBsaW5nUmF0ZT0iNDgwMDAiIGNvZGVjcz0idm9yYmlzIiBpZD0iMSIgbGFuZz0iZW5nIiBtaW1lVHlwZT0iYXVkaW8vd2VibSIgc3Vic2VnbWVudFN0YXJ0c1dpdGhTQVA9IjEiPjxSZXByZXNlbnRhdGlvbiBiYW5kd2lkdGg9IjIwMTA5IiBpZD0iMiI+PEJhc2VVUkwvPjxTZWdtZW50QmFzZSBpbmRleFJhbmdlPSIzMTk3ODAtMzIwNjEyIj48SW5pdGlhbGl6YXRpb24gcmFuZ2U9IjAtMjA4NzAiLz48L1NlZ21lbnRCYXNlPjwvUmVwcmVzZW50YXRpb24+PC9BZGFwdGF0aW9uU2V0PjwvUGVyaW9kPjwvTVBEPg
diff --git a/dom/media/test/dash_detect_stream_switch.sjs b/dom/media/test/dash_detect_stream_switch.sjs
new file mode 100644
index 0000000000..b8480a1274
--- /dev/null
+++ b/dom/media/test/dash_detect_stream_switch.sjs
@@ -0,0 +1,143 @@
+/* -*- Mode: JavaScript; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* dash_detect_stream_switch.sjs
+ *
+ * Parses requests for DASH manifests and ensures stream switching takes place
+ * by verifying the subsegments downloaded and the streams they belong to.
+ * If unexpected subsegments (byte ranges) are requested, the script will
+ * will respond with a 404.
+ */
+
+var DEBUG = false;
+
+function parseQuery(request, key) {
+ var params = request.queryString.split("&");
+ if (DEBUG) {
+ dump('DASH-SJS: request params = "' + params + '"\n');
+ }
+ for (var j = 0; j < params.length; ++j) {
+ var p = params[j];
+ if (p == key) {
+ return true;
+ }
+ if (p.indexOf(key + "=") === 0) {
+ return p.substring(key.length + 1);
+ }
+ if (!p.includes("=") && key === "") {
+ return p;
+ }
+ }
+ return false;
+}
+
+function handleRequest(request, response) {
+ try {
+ var name = parseQuery(request, "name");
+ var range = request.hasHeader("Range")
+ ? request.getHeader("Range")
+ : undefined;
+
+ // Should not get request for 1st subsegment from 2nd stream, nor 2nd
+ // subsegment from 1st stream.
+ if (
+ (name == "dash-webm-video-320x180.webm" &&
+ range == "bytes=25514-32767") ||
+ (name == "dash-webm-video-428x240.webm" && range == "bytes=228-35852")
+ ) {
+ throw new Error(
+ "Should not request " + name + " with byte-range " + range
+ );
+ } else {
+ var rangeSplit = range.split("=");
+ if (rangeSplit.length != 2) {
+ throw new Error(
+ "DASH-SJS: ERROR: invalid number of tokens (" +
+ rangeSplit.length +
+ ") delimited by '=' in 'Range' header."
+ );
+ }
+ var offsets = rangeSplit[1].split("-");
+ if (offsets.length != 2) {
+ throw new Error(
+ "DASH-SJS: ERROR: invalid number of tokens (" +
+ offsets.length +
+ ") delimited by '-' in 'Range' header."
+ );
+ }
+ var startOffset = parseInt(offsets[0]);
+ var endOffset = parseInt(offsets[1]);
+ var file = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
+ var fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
+ Ci.nsIFileInputStream
+ );
+ var bis = Cc["@mozilla.org/binaryinputstream;1"].createInstance(
+ Ci.nsIBinaryInputStream
+ );
+
+ var paths = "tests/dom/media/test/" + name;
+ var split = paths.split("/");
+ for (var i = 0; i < split.length; ++i) {
+ file.append(split[i]);
+ }
+
+ fis.init(file, -1, -1, false);
+ // Exception: start offset should be within file bounds.
+ if (startOffset > file.fileSize) {
+ throw new Error(
+ "Starting offset [" +
+ startOffset +
+ "] is after end of file [" +
+ file.fileSize +
+ "]."
+ );
+ }
+ // End offset may be too large in the MPD. Real world HTTP servers just
+ // return what data they can; do the same here - reduce the end offset.
+ if (endOffset >= file.fileSize) {
+ if (DEBUG) {
+ dump(
+ "DASH-SJS: reducing endOffset [" +
+ endOffset +
+ "] to fileSize [" +
+ (file.fileSize - 1) +
+ "]\n"
+ );
+ }
+ endOffset = file.fileSize - 1;
+ }
+ fis.seek(Ci.nsISeekableStream.NS_SEEK_SET, startOffset);
+ bis.setInputStream(fis);
+
+ var byteLengthToRead = endOffset + 1 - startOffset;
+ var totalBytesExpected = byteLengthToRead + startOffset;
+ if (DEBUG) {
+ dump(
+ "DASH-SJS: byteLengthToRead = " +
+ byteLengthToRead +
+ " byteLengthToRead+startOffset = " +
+ totalBytesExpected +
+ " fileSize = " +
+ file.fileSize +
+ "\n"
+ );
+ }
+
+ var bytes = bis.readBytes(byteLengthToRead);
+ response.setStatusLine(request.httpVersion, 206, "Partial Content");
+ response.setHeader("Content-Length", "" + bytes.length, false);
+ response.setHeader("Content-Type", "application/dash+xml", false);
+ var contentRange =
+ "bytes " + startOffset + "-" + endOffset + "/" + file.fileSize;
+ response.setHeader("Content-Range", contentRange, false);
+ response.write(bytes, bytes.length);
+ bis.close();
+ }
+ } catch (e) {
+ dump("DASH-SJS-ERROR: " + e + "\n");
+ response.setStatusLine(request.httpVersion, 404, "Not found");
+ }
+}