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

Side by Side 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, 2 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>MediaStream Recoder Browser Test (w/ MediaSource)</title> 4 <title>MediaStream Recoder Browser Test (w/ MediaSource)</title>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div> Record Real-Time video content browser test.</div> 7 <div> Record Real-Time video content browser test.</div>
8 <video id="video" autoplay></video> 8 <video id="video" autoplay></video>
9 <video id="remoteVideo" autoplay></video> 9 <video id="remoteVideo" autoplay></video>
10 </body> 10 </body>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 }); 158 });
159 }) 159 })
160 .catch(function(err) { 160 .catch(function(err) {
161 return failTest(err.toString()); 161 return failTest(err.toString());
162 }) 162 })
163 .then(function() { 163 .then(function() {
164 reportTestSuccess(); 164 reportTestSuccess();
165 }); 165 });
166 } 166 }
167 167
168 function getConstraintsForDevice(deviceLabel) {
169 return new Promise(function(resolve, reject) {
170 navigator.mediaDevices.enumerateDevices()
171 .then(function(devices) {
172 for (var i = 0; i < devices.length; ++i) {
173 if (deviceLabel == devices[i].label) {
174 return resolve({video:{deviceId: {exact: devices[i].deviceId}}});
175 }
176 }
177 console.error("Expected to have a device with label:" + deviceLabel);
178 resolve(null);
179 });
180 });
181 }
182
168 // Tests that when MediaRecorder's start() function is called, some data is 183 // Tests that when MediaRecorder's start() function is called, some data is
169 // made available by media recorder via dataavailable events, containing non 184 // made available by media recorder via dataavailable events, containing non
170 // empty blob data. 185 // empty blob data.
171 function testStartAndDataAvailable(codec) { 186 function testStartAndDataAvailable(codec, deviceLabel) {
172 var videoSize = 0; 187 var videoSize = 0;
173 var emptyBlobs = 0; 188 var emptyBlobs = 0;
174 var timeStamps = []; 189 var timeStamps = [];
175 const mimeType = codec ? "video/webm;codecs=" + String(codec) : ""; 190 var mediaConstrains = deviceLabel ? getConstraintsForDevice(deviceLabel) :
176 navigator.mediaDevices.getUserMedia(DEFAULT_CONSTRAINTS) 191 Promise.resolve(DEFAULT_CONSTRAINTS);
192
193 mediaConstrains.then(function(constraints) {
194 return navigator.mediaDevices.getUserMedia(constraints);
195 })
177 .then(function(stream) { 196 .then(function(stream) {
197 const mimeType = codec ? "video/webm;codecs=" + String(codec) : "";
178 return createAndStartMediaRecorder(stream, mimeType); 198 return createAndStartMediaRecorder(stream, mimeType);
179 }) 199 })
180 .then(function(recorder) { 200 .then(function(recorder) {
181 // Save history of Blobs received via dataavailable. 201 // Save history of Blobs received via dataavailable.
182 recorder.ondataavailable = function(event) { 202 recorder.ondataavailable = function(event) {
183 timeStamps.push(event.timeStamp); 203 timeStamps.push(event.timeStamp);
184 if (event.data.size > 0) 204 if (event.data.size > 0)
185 videoSize += event.data.size; 205 videoSize += event.data.size;
186 else 206 else
187 emptyBlobs += 1; 207 emptyBlobs += 1;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 return failTest(err.toString()); 611 return failTest(err.toString());
592 }) 612 })
593 .then(function() { 613 .then(function() {
594 reportTestSuccess(); 614 reportTestSuccess();
595 }); 615 });
596 } 616 }
597 617
598 </script> 618 </script>
599 </body> 619 </body>
600 </html> 620 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698