| OLD | NEW |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 function getAudioLevelFromStats_(response) { | 63 function getAudioLevelFromStats_(response) { |
| 64 var reports = response.result(); | 64 var reports = response.result(); |
| 65 var audioOutputLevels = []; | 65 var audioOutputLevels = []; |
| 66 for (var i = 0; i < reports.length; ++i) { | 66 for (var i = 0; i < reports.length; ++i) { |
| 67 var report = reports[i]; | 67 var report = reports[i]; |
| 68 if (report.names().indexOf('audioOutputLevel') != -1) { | 68 if (report.names().indexOf('audioOutputLevel') != -1) { |
| 69 audioOutputLevels.push(report.stat('audioOutputLevel')); | 69 audioOutputLevels.push(report.stat('audioOutputLevel')); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 // Should only be one audio level reported, otherwise we get confused. | 72 // Should only be one audio level reported, otherwise we get confused. |
| 73 expectEquals(1, audioOutputLevels.length); | 73 assertEquals(1, audioOutputLevels.length); |
| 74 | 74 |
| 75 return audioOutputLevels[0]; | 75 return audioOutputLevels[0]; |
| 76 } | 76 } |
| OLD | NEW |