[client] usb audio: add asynchronous clock feedback

Advertise an asynchronous UAC2 OUT endpoint with explicit feedback so
Windows paces USB audio from the host playback clock.

Drive feedback from measured backend consumption plus the existing
buffer phase controller. Preserve the local and backend resampler paths
for providers without active feedback.

Keep audio diagnostics in the correct clock domains, report ring and
backend latency separately, and avoid hot-path feedback wakeups.
This commit is contained in:
Geoffrey McRae
2026-08-10 04:44:55 +10:00
parent fa8a95569a
commit 0f3c1db261
5 changed files with 420 additions and 134 deletions

View File

@@ -156,12 +156,15 @@ typedef struct LG_AudioOps
bool (*recordData)(void * opaque, uint32_t generation,
const void * data, size_t frames, const LG_AudioClock * sourceClock);
/* Optional active synchronization feedback. This is called outside the
* realtime audio callback with the measured playback device clock. Its
* position uses the device's independent output-frame timeline and its time
* includes the backend's estimated presentation latency. */
/* Optional active synchronization feedback. A provider implementing this
* owns playback rate control, so the client preserves its frame rate and
* does not activate a local resampler. This is called outside the realtime
* audio callback with the measured playback device clock. Its position uses
* the device's independent output-frame timeline and its time includes the
* backend's estimated presentation latency. targetRate is the source frame
* rate requested by the client's buffer controller. */
bool (*clockFeedback)(void * opaque, uint32_t generation,
const LG_AudioClock * playbackClock);
const LG_AudioClock * playbackClock, double targetRate);
}
LG_AudioOps;