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

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

Issue 1407703003: Reland: Use GpuMemoryBufferVideoFramePool for WebMediaPlayerMS and MediaStreamVideoRendererSink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/test/data/media/getusermedia.html ('k') | media/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // These must match with how the video and canvas tags are declared in html. 5 // These must match with how the video and canvas tags are declared in html.
6 const VIDEO_TAG_WIDTH = 320; 6 const VIDEO_TAG_WIDTH = 320;
7 const VIDEO_TAG_HEIGHT = 240; 7 const VIDEO_TAG_HEIGHT = 240;
8 8
9 // Fake video capture background green is of value 135. 9 // Fake video capture background green is of value 135.
10 const COLOR_BACKGROUND_GREEN = 135; 10 const COLOR_BACKGROUND_GREEN = 135;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 var accumulatedLuma = 0; 203 var accumulatedLuma = 0;
204 for (var i = 0; i < pixels.length; i += 4) { 204 for (var i = 0; i < pixels.length; i += 4) {
205 // Ignore the alpha channel. 205 // Ignore the alpha channel.
206 accumulatedLuma += rec702Luma_(pixels[i], pixels[i + 1], pixels[i + 2]); 206 accumulatedLuma += rec702Luma_(pixels[i], pixels[i + 1], pixels[i + 2]);
207 if (accumulatedLuma > threshold * (i / 4 + 1)) 207 if (accumulatedLuma > threshold * (i / 4 + 1))
208 return false; 208 return false;
209 } 209 }
210 return true; 210 return true;
211 } 211 }
212 212
213 // Checks if the given color is within 1 value away from COLOR_BACKGROUND_GREEN.
214 function isAlmostBackgroundGreen(color) {
215 if (Math.abs(color - COLOR_BACKGROUND_GREEN) > 1)
216 return false;
217 return true;
218 }
219
213 // Use Luma as in Rec. 709: Y′709 = 0.2126R + 0.7152G + 0.0722B; 220 // Use Luma as in Rec. 709: Y′709 = 0.2126R + 0.7152G + 0.0722B;
214 // See http://en.wikipedia.org/wiki/Rec._709. 221 // See http://en.wikipedia.org/wiki/Rec._709.
215 function rec702Luma_(r, g, b) { 222 function rec702Luma_(r, g, b) {
216 return 0.2126 * r + 0.7152 * g + 0.0722 * b; 223 return 0.2126 * r + 0.7152 * g + 0.0722 * b;
217 } 224 }
218 225
219 // This function matches |left| and |right| and fails the test if the 226 // This function matches |left| and |right| and fails the test if the
220 // values don't match using normal javascript equality (i.e. the hard 227 // values don't match using normal javascript equality (i.e. the hard
221 // types of the operands aren't checked). 228 // types of the operands aren't checked).
222 function assertEquals(expected, actual) { 229 function assertEquals(expected, actual) {
(...skipping 16 matching lines...) Expand all
239 devices.forEach(function(device) { 246 devices.forEach(function(device) {
240 if (device.kind == 'video') 247 if (device.kind == 'video')
241 hasVideoInputDevice = true; 248 hasVideoInputDevice = true;
242 }); 249 });
243 250
244 if (hasVideoInputDevice) 251 if (hasVideoInputDevice)
245 sendValueToTest('has-video-input-device'); 252 sendValueToTest('has-video-input-device');
246 else 253 else
247 sendValueToTest('no-video-input-devices'); 254 sendValueToTest('no-video-input-devices');
248 }); 255 });
249 } 256 }
OLDNEW
« no previous file with comments | « content/test/data/media/getusermedia.html ('k') | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698