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

Side by Side Diff: content/test/data/media/getusermedia-depth-capture.html

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: Added to MediaTrackSupportedConstraints and MediaTrackConstraintSet. Thanks mcasas@. 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 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script>
4 <script type="text/javascript" src="depth_stream_test_utilities.js"></script> 4 <script type="text/javascript" src="depth_stream_test_utilities.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 6
7 function cubemapFaces(gl) { 7 function cubemapFaces(gl) {
8 return [gl.TEXTURE_CUBE_MAP_POSITIVE_X, 8 return [gl.TEXTURE_CUBE_MAP_POSITIVE_X,
9 gl.TEXTURE_CUBE_MAP_NEGATIVE_X, 9 gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
10 gl.TEXTURE_CUBE_MAP_POSITIVE_Y, 10 gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
(...skipping 18 matching lines...) Expand all
29 detectVideoInLocalView1(stream, function() { 29 detectVideoInLocalView1(stream, function() {
30 testVideoToImageBitmap('local-view-1', function() { 30 testVideoToImageBitmap('local-view-1', function() {
31 stream.getVideoTracks()[0].stop(); 31 stream.getVideoTracks()[0].stop();
32 waitForVideoToStop('local-view-1'); 32 waitForVideoToStop('local-view-1');
33 }, failedCallback); 33 }, failedCallback);
34 }); 34 });
35 }, 35 },
36 failedCallback); 36 failedCallback);
37 } 37 }
38 38
39 function getDepthStreamAndCameraCalibration() {
40 console.log('Calling getDepthStreamAndCameraCalibration');
41 getFake16bitStream().then(function(stream) {
42 var depth_track = stream.getVideoTracks()[0];
43 if (!depth_track)
44 return failTest("No depth_track");
45 var settings = depth_track.getSettings();
46 if (settings && settings.depthNear == 0 && settings.depthFar == 65.535 &&
47 settings.focalLengthX == 135.0 && settings.focalLengthY == 135.6) {
48 reportTestSuccess();
49 } else {
50 failTest("Unexpected depth_track settings:" + JSON.stringify(settings));
51 }
52 },
53 failedCallback);
54 }
55
56 function getBothStreamsAndCheckForFeaturesPresence() {
57 console.log('Calling getBothStreamsAndCheckForFeaturesPresence');
58 getConstraintsForDevice("fake_device_0")
59 .then(function(constraints) {
60 if (!constraints)
61 return failTest("No fake video device found.");
62 return navigator.mediaDevices.getUserMedia(constraints);
63 }).then(function(video_stream) {
64 getFake16bitStream().then(function(depth_stream) {
65 if (video_stream.getVideoTracks().length != 1) {
66 return failTest("Expected one video track, got " +
67 video_stream.getVideoTracks().length);
68 }
69 if (depth_stream.getVideoTracks().length != 1) {
70 return failTest("Expected one depth track, got " +
71 depth_stream.getVideoTracks().length);
72 }
73 var video_track = video_stream.getVideoTracks()[0];
74 var depth_track = depth_stream.getVideoTracks()[0];
75
76 // We have specified the fields in getUserMedia constraints. Expect that both
77 // tracks have them in constraints and settings.
mcasas 2017/01/30 15:10:15 Although not 100% enforced, try to keep this file
aleksandar.stojiljkovic 2017/02/07 04:56:07 Done.
78 var expected_fields = ["deviceId", "height", "width"];
79 for (var field in expected_fields) {
80 var expected_field = expected_fields[field];
81 if (video_track.getSettings()[expected_field] === undefined) {
82 return failTest(expected_field +
83 " missing from video track getSettings().");
84 }
85 if (video_track.getConstraints()[expected_field] === undefined) {
86 return failTest(expected_field +
87 " missing from video track getConstraints().");
88 }
89 if (depth_track.getSettings()[expected_field] === undefined) {
90 return failTest(expected_field +
91 " missing from depth track getSettings().");
92 }
93 if (depth_track.getConstraints()[expected_field] === undefined) {
94 return failTest(expected_field +
95 " missing from depth track getConstraints().");
96 }
97 }
98
99 var depth_fields = ["depthNear", "depthFar", "focalLengthX",
100 "focalLengthY"];
101 for (var field in depth_fields) {
102 var depth_field = depth_fields[field];
103 if (video_track.getSettings()[depth_field] !== undefined) {
104 return failTest(depth_field +
105 " present in video track getSettings().");
106 }
107 if (depth_track.getSettings()[depth_field] === undefined) {
108 return failTest(depth_field +
109 " missing from depth track getSettings().");
110 }
111 }
112 reportTestSuccess();
113 },
114 failedCallback);
115 },
116 failedCallback);
117 }
118
39 function depthStreamToRGBAUint8Texture() { 119 function depthStreamToRGBAUint8Texture() {
40 console.log('Calling depthStreamToRGBAUint8Texture'); 120 console.log('Calling depthStreamToRGBAUint8Texture');
41 getFake16bitStream().then(function(stream) { 121 getFake16bitStream().then(function(stream) {
42 detectVideoInLocalView1(stream, function() { 122 detectVideoInLocalView1(stream, function() {
43 testVideoToRGBA8Texture('local-view-1', function() { 123 testVideoToRGBA8Texture('local-view-1', function() {
44 stream.getVideoTracks()[0].stop(); 124 stream.getVideoTracks()[0].stop();
45 waitForVideoToStop('local-view-1'); 125 waitForVideoToStop('local-view-1');
46 }, failedCallback); 126 }, failedCallback);
47 }); 127 });
48 }, 128 },
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 <tr> 416 <tr>
337 <td><video id="local-view-1" width="96" height="96" autoplay 417 <td><video id="local-view-1" width="96" height="96" autoplay
338 style="display:none"></video></td> 418 style="display:none"></video></td>
339 <!-- The canvas is used to detect when video starts and stops. --> 419 <!-- The canvas is used to detect when video starts and stops. -->
340 <td><canvas id="local-view-1-canvas" width="96" height="96" 420 <td><canvas id="local-view-1-canvas" width="96" height="96"
341 style="display:none"></canvas></td> 421 style="display:none"></canvas></td>
342 </tr> 422 </tr>
343 </table> 423 </table>
344 </body> 424 </body>
345 </html> 425 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698