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

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

Issue 118163002: All WebRTC content browsertests will now force iSAC 16K on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/test/data/media/peerconnection-call.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Audio test utilities. 5 // Audio test utilities.
6 6
7 // Gathers |numSamples| samples at |frequency| number of times per second and 7 // Gathers |numSamples| samples at |frequency| number of times per second and
8 // calls back |callback| with an array with numbers in the [0, 32768] range. 8 // calls back |callback| with an array with numbers in the [0, 32768] range.
9 function gatherAudioLevelSamples(peerConnection, numSamples, frequency, 9 function gatherAudioLevelSamples(peerConnection, numSamples, frequency,
10 callback) { 10 callback) {
(...skipping 22 matching lines...) Expand all
33 largest = Math.max(largest, samples[i]); 33 largest = Math.max(largest, samples[i]);
34 34
35 console.log('Average audio level: ' + average + ', largest: ' + largest); 35 console.log('Average audio level: ' + average + ', largest: ' + largest);
36 36
37 // TODO(phoglund): Make a more sophisticated curve-fitting algorithm. We want 37 // TODO(phoglund): Make a more sophisticated curve-fitting algorithm. We want
38 // to see a number of peaks with relative silence between them. The following 38 // to see a number of peaks with relative silence between them. The following
39 // seems to work fine on a nexus 7. 39 // seems to work fine on a nexus 7.
40 if (average < 3000 || average > 8000) 40 if (average < 3000 || average > 8000)
41 throw 'Unexpected avg audio level: got ' + average + ', expected it ' + 41 throw 'Unexpected avg audio level: got ' + average + ', expected it ' +
42 'to be 4000 < avg < 8000.' 42 'to be 4000 < avg < 8000.'
43 if (largest < 30000) 43 if (largest < 25000)
44 throw 'Too low max audio level: got ' + largest + ', expected > 30000.'; 44 throw 'Too low max audio level: got ' + largest + ', expected > 30000.';
45 }; 45 };
46 46
47 // If silent (like when muted), we should get very near zero audio level. 47 // If silent (like when muted), we should get very near zero audio level.
48 function verifyIsSilent(samples) { 48 function verifyIsSilent(samples) {
49 var average = 0; 49 var average = 0;
50 for (var i = 0; i < samples.length; ++i) 50 for (var i = 0; i < samples.length; ++i)
51 average += samples[i] / samples.length; 51 average += samples[i] / samples.length;
52 52
53 console.log('Average audio level: ' + average); 53 console.log('Average audio level: ' + average);
(...skipping 11 matching lines...) Expand all
65 var report = reports[i]; 65 var report = reports[i];
66 if (report.names().indexOf('audioOutputLevel') != -1) { 66 if (report.names().indexOf('audioOutputLevel') != -1) {
67 audioOutputLevels.push(report.stat('audioOutputLevel')); 67 audioOutputLevels.push(report.stat('audioOutputLevel'));
68 } 68 }
69 } 69 }
70 // Should only be one audio level reported, otherwise we get confused. 70 // Should only be one audio level reported, otherwise we get confused.
71 expectEquals(1, audioOutputLevels.length); 71 expectEquals(1, audioOutputLevels.length);
72 72
73 return audioOutputLevels[0]; 73 return audioOutputLevels[0];
74 } 74 }
OLDNEW
« no previous file with comments | « content/test/data/media/peerconnection-call.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698