ioap_hf_start_latency_test()

Start a latency test.

Synopsis:

#include <acoustic/hf.h>

int ioap_hf_start_latency_test(int apd, const ioap_hf_latency_test_t* test) ;

Arguments:

apd
The handle returned by ioap_hf_attach() when it attaches to a process to io-acoustic.
test
Pointer to the latency test configuration structure.

Library:

libacoustic

Description:

The ioap_hf_start_latency_test() function starts a latency test. A latency test injects a series of nine clicks into the receive output and gathers statistics from the signal captured on the specified output.

To retrieve the results of a latency test, call ioap_hf_get_latency_estimate() and look at the values in the ioap_hf_latency_estimate_t data structure.

The results of a latency test can be used to configure the time (in milliseconds) to prime speaker or phone output on "go" in order to compensate for system latency. This time period is platform specific, and should be adjusted to the shortest time possible (that is, the shortest time period that is sufficient to prevent underruns).

A latency test determines the latency for each of nine clicks that are played back. The two smallest and two largest latency values are discarded. The remaining five latency values are used to calculate the three values returned by the test:

A successful latency test should return a latency-spread of < 4 milliseconds and a cross-correlation of > 500. If the latency-spread is greater than 4 milliseconds or the cross-correlation is less than 500, the signal-to-noise ratio of the clicks should be increased, for example by increasing the playback volume or decreasing the ambient noise level. If the system latency is > 100 milliseconds, you should increase the offset specified when starting the test in order to move the estimate calculation into the correct measurement window.

The msrefdelta_default key in the .conf configuration file should be set to the difference between the msprime and the returned latency estimate. See "Configuration keys".

Returns:

0
Success
-1
An error occurred (errno is set).

Errors:

EINVAL
Invalid handle, null pointer argument or test argument.
EACCESS
Acoustic processing hasn't been started.
EBUSY
Test already in progress.
EFAULT
An error occurred during the test.
ENOTSUP
Diagnostics processing hasn't been enabled.

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread Yes