[client] audio: allow the audiodev to return the periodFrames

This change allows the audiodevs to return the minimum period frames
needed to start playback instead of having to rely on a pull to obtain
these details.

Additionally we are using this information to select an initial start
latency as well as to train the desired latency in order to keep it as
low as possible.
This commit is contained in:
Geoffrey McRae
2022-01-27 17:20:28 +11:00
parent dd2d84a080
commit 41884bfcc5
4 changed files with 69 additions and 50 deletions

View File

@@ -47,11 +47,11 @@ struct LG_AudioDevOps
/* setup the stream for playback but don't start it yet
* Note: the pull function returns f32 samples
*/
void (*setup)(int channels, int sampleRate, LG_AudioPullFn pullFn);
void (*setup)(int channels, int sampleRate, LG_AudioPullFn pullFn,
int * periodFrames);
/* called when there is data available to start playback
* return true if playback should start */
bool (*start)(int framesBuffered);
/* called when there is data available to start playback */
void (*start)();
/* called when SPICE reports the audio stream has stopped */
void (*stop)(void);