I was trying to find a bug in the timestamping logic I am working on and after some time I realized the USB audio class driver seems to have an issue. If I instrument the code in sound/usb/pcm.c, I see a offset of up to 6ms between the snd_usb_substream_playback_trigger and prepare_playback_urb steps
[45053.102625] trigger_start [45053.108320] prepare_playback_urb
My understanding is that empty URBs are submitted in the prepare step to avoid underflows, which is fine. The problem with that is that the trigger_tstamp value is captured before audio transfers actually start and there is a constant offset when trying to track audio/system time drifts or do basic a/v sync.
Any suggestions on how to fix this? I can't figure out if this is an off-by-one error or another bug. Feedback welcome. -Pierre