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 12All tests require: 13 14* host computer 15* ADB installed 16* ADB USB cable 17 18The latency, glitch and data_paths tests also need: 19 20* [loopback adapter](https://source.android.com/devices/audio/latency/loopback) 21* a 3.5 mm jack on the phone* 22 23\* If you don't have a 3.5 mm jack then you can use a USB-C to 3.5mm adapter. 24In order to use ADB at the same time you will also need a USB switching device 25or use ADB/Wifi. 26 27## Start App from Intent 28 29The app can be started by sending a Start comment to the OboeTester class. 30The app will run and the results will be written to a file. 31 32 adb shell am start -n com.mobileer.oboetester/.MainActivity {parameters} 33 34String parameters are sent using: 35 36 --es {parameterName} {parameterValue} 37 38For example: 39 40 --es test latency 41 42Integer parameters are sent using: 43 44 --ei {parameterName} {parameterValue} 45 46For example: 47 48 --ei buffer_bursts 8 49 50Boolean parameters are sent using: 51 52 --ez {parameterName} {parameterValue} 53 54For example: 55 56 --ez use_input_presets false 57 58## Parameters 59 60There are two required parameters for all tests: 61 62 --es test {latency, glitch, data_paths, input, output, cpu_load} 63 The "latency" test will perform a Round Trip Latency test. 64 It will request EXCLUSIVE mode for minimal latency. 65 The "glitch" test will perform a single Glitch test. 66 The "data_paths" test will verify input and output streams in many possible configurations. 67 The "input" test will open and start an input stream. 68 The "output" test will open and start an output stream. 69 The "cpu_load" test will run the CPU LOAD activity. 70 71 --es file {name of resulting file} 72 73The file will be stored in a directory that can be written by OboeTester without any special permissions. 74This is typically "/storage/emulated/0/Android/data/com.mobileer.oboetester/files/". 75 76There are some optional parameter in common for all tests: 77 78 --ef volume {volume} // normalized volume in the range of 0.0 to 1.0 79 --es volume_type {"accessibility", "alarm", "dtmf", "music", "notification", "ring", "system", "voice_call"} 80 Stream type for the setStreamVolume() call. Default is "music". 81 --ez background {"true", 1, "false", 0} // if true then Oboetester will continue to run in the background 82 --ez foreground_service {"true", 1, "false", 0} // if true then Oboetester will ask for record/play permissions via a foreground service 83 84There are several optional parameters in common for glitch, latency, input, and output tests: 85 86 --ei buffer_bursts {bursts} // number of bursts in the buffer, 2 for "double buffered" 87 --es in_api {"unspecified", "opensles", "aaudio"} // native input API, default is "unspecified" 88 --es out_api {"unspecified", "opensles", "aaudio"} // native output API, default is "unspecified" 89 --es in_channel_mask {"mono", "stereo", "2.1", "tri", "triBack", "3.1", "2.0.2", "2.1.2", "3.0.2", "3.1.2", "quad", "quadSide", "surround", "penta", "5.1", "5.1Side", "6.1", "7.1", "5.1.2", "5.1.4", "7.1.2", "7.1.4", "9.1.4", "9.1.6", "frontBack"} 90 --es out_channel_mask {"mono", "stereo", "2.1", "tri", "triBack", "3.1", "2.0.2", "2.1.2", "3.0.2", "3.1.2", "quad", "quadSide", "surround", "penta", "5.1", "5.1Side", "6.1", "7.1", "5.1.2", "5.1.4", "7.1.2", "7.1.4", "9.1.4", "9.1.6", "frontBack"} 91 --ei in_channels {samples} // number of input channels, default is 2. This is ignored if in_channel_mask is set. 92 --ei out_channels {samples} // number of output channels, default is 2. This is ignored if out_channel_mask is set. 93 --ei sample_rate {hertz} 94 --es in_perf {"none", "lowlat", "powersave"} // input performance mode, default is "lowlat" 95 --es out_perf {"none", "lowlat", "powersave"} // output performance mode, default is "lowlat" 96 --es out_usage {"media", "voice_communication", "alarm", "notification", "game"} // default is media 97 --es in_sharing {"shared", "exclusive"} // input sharing mode, default is "exclusive" 98 --es out_sharing {"shared", "exclusive"} // output sharing mode, default is "exclusive" 99 --ez in_use_mmap {"true", 1, "false", 0} // if true then MMAP is allowed, if false then MMAP will be disabled 100 --ez out_use_mmap {"true", 1, "false", 0} // if true then MMAP is allowed, if false then MMAP will be disabled 101 102There are some optional parameters in common for glitch, input, and output tests: 103 104 --ei duration {seconds} // glitch test duration, default is 10 seconds 105 106There are several optional parameters for just the "glitch" test: 107 108 --ef tolerance {tolerance} // amount of deviation from expected that is considered a glitch 109 // Range of tolerance is 0.0 to 1.0. Default is 0.1. Note use of "-ef". 110 // input preset, default is "voicerec" 111 --es in_preset ("generic", "camcorder", "voicerec", "voicecomm", "unprocessed", "performance"} 112 113There are several optional parameters for just the "data_paths" test. Note the Note the use of "-ez" for the boolean parameters. 114 115 --ez use_input_presets {"true", 1, "false", 0} // Whether to test various input presets. 116 --ez use_all_sample_rates {"true", 1, "false", 0} // Whether to test all sample rates. Note use of "-ez". Default is false 117 --ei single_test_index {testId} // Index for testing one specific test 118 119These parameters are used with the "data_paths" test starting with v2.5.11. 120 121 --ez use_input_channel_masks {"true", 1, "false", 0} // Whether to test the reported input channel MASKS. Default is false. 122 --ez use_all_channel_counts {"true", 1, "false", 0} // Whether to test all the supported channel COUNTS. Default is true. 123 --ei output_channel_masks_level {0, 1, 2} // Whether to test NONE=0, SOME=1, or ALL=2 channel masks. Default is false. 124 125These parameters were used with the "data_paths" test prior to v2.5.11. 126 127 --ez use_input_devices {"true", 1, "false", 0} // Whether to test various input devices. 128 --ez use_output_devices {"true", 1, "false", 0} // Whether to test various output devices. 129 --ez use_all_output_channel_masks {"true", 1, "false", 0} // Whether to test all output channel masks. Default is false. 130 131There are some optional parameters for just the "output" test: 132 133 --es signal_type {sine, sawtooth, freq_sweep, pitch_sweep, white_noise} // type of sound to play, default is sine 134 135There are some optional parameters for just the "cpu_load" test: 136 137 --ez use_adpf {true, false} // if true, use work boost from performance hints. Default is false. 138 --ez use_workload {true, false} // if true and using ADPF then report workload changes. Default is false. 139 --ez scroll_graphics {true, false} // if true then continually update the power scope. Default is false. 140 141For example, a complete command for a "latency" test might be: 142 143 adb shell am start -n com.mobileer.oboetester/.MainActivity \ 144 --es test latency \ 145 --ei buffer_bursts 2 \ 146 --ef volume 0.8 \ 147 --es volume_type music \ 148 --ei out_channels 1 \ 149 --es out_usage game \ 150 --es file latency20230608.txt 151 152or for a "glitch" test: 153 154 adb shell am start -n com.mobileer.oboetester/.MainActivity \ 155 --es test glitch \ 156 --es in_perf lowlat \ 157 --es out_perf lowlat \ 158 --es in_sharing exclusive \ 159 --es out_sharing exclusive \ 160 --ei buffer_bursts 2 \ 161 --ei sample_rate 48000 \ 162 --ef tolerance 0.123 \ 163 --ei in_channels 2 \ 164 --es file glitch20230608.txt 165 166or for a "data_paths" test: 167 168 adb shell am start -n com.mobileer.oboetester/.MainActivity \ 169 --es test data_paths \ 170 --ez use_input_presets true \ 171 --ez use_input_devices false \ 172 --ez use_output_devices true \ 173 --es file datapaths20230608.txt 174 175## Interpreting Test Results 176 177Test results are simple files with "name = value" pairs. 178After running the test you can determine where the results file was written by entering: 179 180 adb logcat | grep EXTFILE 181 182The test results can be obtained using adb pull. For example: 183 184 adb pull /storage/emulated/0/Android/data/com.mobileer.oboetester/files/glitch20230608.txt . 185 186The beginning of the report is common to latency and glitch tests: 187 188``` 189build.fingerprint = google/cheetah/cheetah:14/MASTER/eng.philbu.20230518.172104:userdebug/dev-keys 190test.version = 2.5.1 191test.version.code = 72 192time.millis = 1686156503523 193in.channels = 2 194in.perf = ll 195in.preset = voicerec 196in.sharing = ex 197in.api = aaudio 198in.rate = 48000 199in.device = 22 200in.mmap = yes 201in.rate.conversion.quality = 0 202in.hardware.channels = 2 203in.hardware.sampleRate = 48000 204in.hardware.format = i32 205in.burst.frames = 96 206in.xruns = 0 207out.channels = 1 208out.perf = ll 209out.usage = game 210out.contentType = music 211out.sharing = ex 212out.api = aaudio 213out.rate = 48000 214out.device = 3 215out.mmap = yes 216out.rate.conversion.quality = 0 217out.hardware.channels = 2 218out.hardware.sampleRate = 48000 219out.hardware.format = float 220out.burst.frames = 96 221out.buffer.size.frames = 192 222out.buffer.capacity.frames = 1920 223out.xruns = 0 224``` 225 226### Latency Report 227 228Each test also adds specific value. For "latency". If the test fails then some values will be unavailable. 229 230Here is a report from a good test. The '#' comments were added for this document and are not in the report. 231 232``` 233confidence = 0.892 # quality of the latency result between 0.0 and 1.0, higher is better 234result.text = OK # text equivalent of the result 235latency.msec = 23.27 # round trip latency in milliseconds 236latency.frames = 1117 # round trip latency in frames 237latency.empty.msec = 19.27 # round trip latency if the top output buffer was empty 238latency.empty.frames = 925 # same but translated to frames 239rms.signal = 0.03142 # Root Mean Square of the signal, if it can be detected 240rms.noise = 0.00262 # Root Mean Square of the background noise before the signal is detected 241correlation = 0.975 # raw normalized cross-correlation peak 242timestamp.latency.msec = 10.35 # latency based on timestamps 243timestamp.latency.mad = 0.05 # Mean absolute deviation 244timestamp.latency.count = 12 # number of measurements 245reset.count = 1 # number of times the full duplex stream input underflowed and had to resynchronize 246result = 0 # 0 or a negative error 247``` 248 249Here is a report from a test that failed because the output was muted. Note the latency.msec is 250missing because it could not be measured. 251 252 rms.signal = 0.00000 253 rms.noise = 0.00048 254 reset.count = 3 255 result = -96 256 result.text = ERROR_CONFIDENCE 257 confidence = 0.009 258 259### Glitch Report 260 261Here is a report from a good test. The '#' comments were added for this document and are not in the report. 262 263 tolerance = 0.123 264 state = LOCKED 265 unlocked.frames = 2528 # frames spent trying to lock onto the signal 266 locked.frames = 384084 # frames spent locked onto a good signal with no glitches 267 glitch.frames = 0 # frames spent glitching or recovering from a glitch 268 reset.count = 208 # number of times the full duplex stream input underflowed and had to resynchronize 269 peak.amplitude = 0.057714 # peak amplitude of the input signal, between 0.0 and 1.0 270 signal.noise.ratio.db = 96.3 271 time.total = 9.96 seconds # close to your specified duration 272 time.no.glitches = 9.96 # time we have been running with no glitches 273 max.time.no.glitches = 9.96 # max time with no glitches 274 glitch.count = 0 # number of glitch events, actual number may be higher if close together 275 276Here is a report from a test that failed because the output was muted. Note the glitch.count is 277missing because it could not be measured. 278 279 state = WAITING_FOR_SIGNAL 280 unlocked.frames = 0 281 locked.frames = 0 282 glitch.frames = 0 283 reset.count = 1 284 time.total = 9.95 seconds 285 286### Data Paths Report 287 288The report first goes through the info about the specific device before going through input preset tests, 289input devices tests, and output tests. 290Each will show the specific configuration of a test before showing whether it passed or failed. 291At the end of the report, an analysis of the failed tests will be given 292followed by the number of passed, failed, and skipped tests. 293