1[Home](README.md) 2 3# Automated Testing 4 5OboeTester can be used to measure the round trip latency and glitches. 6It can be launched from a shell script by using an Android Intent. 7 8Before running the app from an Intent, it should be launched manually and a Round Trip Latency test run. Then you can give permission for using the microphone to record the looped back sound, and give permission to write to external storage for saving the test result. 9 10## Requirements 11 12* host computer 13* ADB USB cable 14* [loopback adapter](https://source.android.com/devices/audio/latency/loopback) 15* a 3.5 mm jack on the phone* 16 17\* If you don't have a 3.5 mm jack then you can use a USB-C to 3.5mm adapter. Then you will also need a USB switching device such as [TigerTail](https://go/tigertail). 18 19## Start App from Intent 20 21The app can be started by sending a Start comment to the OboeTester class. 22The app will run and the results will be written to a file. 23 24 adb shell am start -n com.google.sample.oboe.manualtest/.MainActivity {parameters} 25 26String parameters are sent using: 27 28 --es {parameterName} {parameterValue} 29 30For example: 31 32 --es test latency 33 34Integer parameters are sent using: 35 36 --ei {parameterName} {parameterValue} 37 38For example: 39 40 --ei buffer_bursts 8 41 42## Parameters 43 44There are two required parameters: 45 46 --es test {latency, glitch} 47 The "latency" test will perform a Round Trip Latency test. 48 It will request EXCLUSIVE mode for minimal latency. 49 The "glitch" test will perform a single Glitch test. 50 --es file {full path for resulting file} 51 52There are several optional parameter in common for all tests: 53 54 --ei buffer_bursts {bursts} // number of bursts in the buffer, 2 for "double buffered" 55 --es in_api {"unspecified", "opensles", "aaudio"} // native input API, default is "unspecified" 56 --es out_api {"unspecified", "opensles", "aaudio"} // native output API, default is "unspecified" 57 --ei in_channels {samples} // number of input channels, default is 2 58 --ei out_channels {samples} // number of output channels, default is 2 59 --ei sample_rate {hertz} 60 --es in_perf {"none", "lowlat", "powersave"} // input performance mode, default is "lowlat" 61 --es out_perf {"none", "lowlat", "powersave"} // output performance mode, default is "lowlat" 62 --es in_sharing {"shared", "exclusive"} // input sharing mode, default is "exclusive" 63 --es out_sharing {"shared", "exclusive"} // output sharing mode, default is "exclusive" 64 65There are several optional parameters for just the "glitch" test: 66 67 --ef tolerance {tolerance} // amount of deviation from expected that is considered a glitch 68 // Range of tolerance is 0.0 to 1.0. Default is 0.1. Note use of "-ef". 69 --ei duration {seconds} // glitch test duration, default is 10 seconds 70 // input preset, default is "voicerec" 71 --es in_preset ("generic", "camcorder", "voicerec", "voicecomm", "unprocessed", "performance"} 72 73For example, a complete command for a "latency" test might be: 74 75 adb shell am start -n com.google.sample.oboe.manualtest/.MainActivity \ 76 --es test latency \ 77 --es file /sdcard/latency20190903.txt \ 78 --ei buffer_bursts 2 \ 79 --ei out_channels 1 80 81or for a "glitch" test: 82 83 adb shell am start -n com.google.sample.oboe.manualtest/.MainActivity \ 84 --es test glitch \ 85 --es file /sdcard/glitch20190903.txt \ 86 --es in_perf lowlat \ 87 --es out_perf lowlat \ 88 --es in_sharing exclusive \ 89 --es out_sharing exclusive \ 90 --ei buffer_bursts 2 \ 91 --ei sample_rate 48000 \ 92 --ef tolerance 0.123 \ 93 --ei in_channels 2 \ 94 95## Interpreting Test Results 96 97Test results are simple files with "name = value" pairs. 98The test results can be obtained using adb pull. 99 100 adb pull /sdcard/test20190611.txt . 101 102The beginning of the report is common to all tests: 103 104 build.fingerprint = google/bonito/bonito:10/QP1A.190711.017/5771233:userdebug/dev-keys 105 test.version = 1.5.10 106 test.version.code = 19 107 time.millis = 1567521906542 108 in.channels = 2 109 in.perf = lowlat 110 in.sharing = exclusive 111 in.api = aaudio 112 in.rate = 48000 113 in.device = 30 114 in.mmap = yes 115 in.burst.frames = 96 116 in.xruns = 0 117 out.channels = 2 118 out.perf = lowlat 119 out.sharing = exclusive 120 out.api = aaudio 121 out.rate = 48000 122 out.device = 27 123 out.mmap = yes 124 out.burst.frames = 96 125 out.buffer.size.frames = 192 126 out.buffer.capacity.frames = 3072 127 out.xruns = 0 128 129### Latency Report 130 131Each test also adds specific value. For "latency". If the test fails then some values will be unavailable. 132 133Here is a report from a good test. The '#' comments were added for this document and are not in the report. 134 135 rms.signal = 0.81829 # Root Mean Square of the signal, if it can be detected 136 rms.noise = 0.12645 # Root Mean Square of the background noise before the signal is detected 137 reset.count = 2 # number of times the full duplex stream input underflowed and had to resynchronize 138 result = 0 # 0 or a negative error 139 result.text = OK # text equivalent of the result 140 latency.empty.frames = 476 # round trip latency if the top output buffer was empty 141 latency.empty.msec = 9.92 # same but translated to milliseconds 142 latency.frames = 668 # round trip latency as measured 143 latency.msec = 13.92 # same but translated to milliseconds, "pro-audioo" devices should be <=20 msec 144 confidence = 0.959 # quality of the latency result between 0.0 and 1.0, higher is better 145 146Here is a report from a test that failed because the output was muted. Note the latency.msec is missing because it could not be measured. 147 148 rms.signal = 0.00000 149 rms.noise = 0.00048 150 reset.count = 3 151 result = -96 152 result.text = ERROR_CONFIDENCE 153 confidence = 0.009 154 155### Glitch Report 156 157Here is a report from a good test. The '#' comments were added for this document and are not in the report. 158 159 tolerance = 0.123 160 state = LOCKED 161 unlocked.frames = 2528 # frames spent trying to lock onto the signal 162 locked.frames = 384084 # frames spent locked onto a good signal with no glitches 163 glitch.frames = 0 # frames spent glitching or recovering from a glitch 164 reset.count = 208 # number of times the full duplex stream input underflowed and had to resynchronize 165 peak.amplitude = 0.057714 # peak amplitude of the input signal, between 0.0 and 1.0 166 signal.noise.ratio.db = 96.3 167 time.total = 9.96 seconds # close to your specified duration 168 time.no.glitches = 9.96 # time we have been running with no glitches 169 max.time.no.glitches = 9.96 # max time with no glitches 170 glitch.count = 0 # number of glitch events, actual number may be higher if close together 171 172Here is a report from a test that failed because the output was muted. Note the glitch.count is missing because it could not be measured. 173 174 state = WAITING_FOR_SIGNAL 175 unlocked.frames = 0 176 locked.frames = 0 177 glitch.frames = 0 178 reset.count = 1 179 time.total = 9.95 seconds 180