Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2948)

Unified Diff: content/test/data/media/mediarecorder_test.html

Issue 2121043002: 16 bpp video stream capture, render and WebGL usage - Realsense R200 & SR300 support. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests: cc, skcanvas_video_renderer, wrtcrecorder... Fake capture supports Y16. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/data/media/mediarecorder_test.html
diff --git a/content/test/data/media/mediarecorder_test.html b/content/test/data/media/mediarecorder_test.html
index 72a707f5f6738f5cefc51d4dd2ee2f5d56253069..8eecbcbcd87b8d5170a7c584316fced970191851 100644
--- a/content/test/data/media/mediarecorder_test.html
+++ b/content/test/data/media/mediarecorder_test.html
@@ -165,16 +165,36 @@ function testStartStopAndRecorderState() {
});
}
+function getConstraintsForDevice(deviceLabel) {
+ return new Promise(function(resolve, reject) {
+ navigator.mediaDevices.enumerateDevices()
+ .then(function(devices) {
+ for (var i = 0; i < devices.length; ++i) {
+ if (deviceLabel == devices[i].label) {
+ return resolve({video:{deviceId: {exact: devices[i].deviceId}}});
+ }
+ }
+ console.error("Expected to have a device with label:" + deviceLabel);
+ resolve(null);
+ });
+ });
+}
+
// Tests that when MediaRecorder's start() function is called, some data is
// made available by media recorder via dataavailable events, containing non
// empty blob data.
-function testStartAndDataAvailable(codec) {
+function testStartAndDataAvailable(codec, deviceLabel) {
var videoSize = 0;
var emptyBlobs = 0;
var timeStamps = [];
- const mimeType = codec ? "video/webm;codecs=" + String(codec) : "";
- navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS)
+ var mediaConstrains = deviceLabel ? getConstraintsForDevice(deviceLabel) :
+ Promise.resolve(DEFAULT_CONSTRAINTS);
+
+ mediaConstrains.then(function(constraints) {
+ return navigator.mediaDevices.getUserMedia(constraints);
+ })
.then(function(stream) {
+ const mimeType = codec ? "video/webm;codecs=" + String(codec) : "";
return createAndStartMediaRecorder(stream, mimeType);
})
.then(function(recorder) {

Powered by Google App Engine
This is Rietveld 408576698