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

Side by Side Diff: content/test/data/media/depth_stream_test_utilities.js

Issue 2664673002: Media Capture Depth Stream Extensions API: videoKind settings and constraint. (Closed)
Patch Set: GetVideoKindForFormat moved to utility. thanks guidou@. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function getConstraintsForDevice(deviceLabel) { 5 function getConstraintsForDevice(deviceLabel) {
6 return new Promise(function(resolve, reject) { 6 return new Promise(function(resolve, reject) {
7 navigator.mediaDevices.enumerateDevices() 7 navigator.mediaDevices.enumerateDevices()
8 .then(function(devices) { 8 .then(function(devices) {
9 for (var i = 0; i < devices.length; ++i) { 9 for (var i = 0; i < devices.length; ++i) {
10 if (deviceLabel == devices[i].label) { 10 if (deviceLabel == devices[i].label) {
(...skipping 14 matching lines...) Expand all
25 .then(function(constraints) { 25 .then(function(constraints) {
26 if (!constraints) 26 if (!constraints)
27 return reject("No fake device found"); 27 return reject("No fake device found");
28 return navigator.mediaDevices.getUserMedia(constraints); 28 return navigator.mediaDevices.getUserMedia(constraints);
29 }).then(function(stream) { 29 }).then(function(stream) {
30 return resolve(stream); 30 return resolve(stream);
31 }); 31 });
32 }); 32 });
33 } 33 }
34 34
35 function getStreamOfVideoKind(constraint_kind) {
36 var constraints = {
37 video:{
38 videoKind: constraint_kind
39 }
40 }
41 return navigator.mediaDevices.getUserMedia(constraints);
42 }
43
35 // Data is RGBA array data and could be used with different formats: 44 // Data is RGBA array data and could be used with different formats:
36 // e.g. Uint8Array, Uint8ClampedArray, Float32Array... 45 // e.g. Uint8Array, Uint8ClampedArray, Float32Array...
37 // Value at point (row, column) is calculated as 46 // Value at point (row, column) is calculated as
38 // (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255 47 // (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255
39 // (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details. 48 // (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details.
40 function verifyPixels( 49 function verifyPixels(
41 data, width, height, flip_y, step, wrap_around, tolerance, test_name) { 50 data, width, height, flip_y, step, wrap_around, tolerance, test_name) {
42 var rowsColumnsToCheck = [[1, 1], 51 var rowsColumnsToCheck = [[1, 1],
43 [0, width - 1], 52 [0, width - 1],
44 [height - 1, 0], 53 [height - 1, 0],
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (Math.abs(calculated - data[i]) > tolerance) { 105 if (Math.abs(calculated - data[i]) > tolerance) {
97 return Promise.reject(test_name + ": reference value " + data[i] + 106 return Promise.reject(test_name + ": reference value " + data[i] +
98 " differs from calculated: " + calculated + 107 " differs from calculated: " + calculated +
99 " at index (row, column) " + i + " (" + row + ", " + column + 108 " at index (row, column) " + i + " (" + row + ", " + column +
100 "). TopLeft value:" + data[0] + ", step:" + step + ", flip_y:" + 109 "). TopLeft value:" + data[0] + ", step:" + step + ", flip_y:" +
101 flip_y); 110 flip_y);
102 } 111 }
103 } 112 }
104 return true; 113 return true;
105 } 114 }
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_track.cc ('k') | content/test/data/media/getusermedia-depth-capture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698