Hello Kevin, I found the issue but I'll reply anyway as it may be useful to other people.
Are you seeing this issue on later system versions?
No, it looks like it's only Monterey, specifically the last two minor releases which I tested on.
Is your XPC service directly presenting it's own window(s) or is this coming through your main app?
Yes, I'm starting a NSApplication on main thread and the service listener on a second thread. That's only difference to regular XPCService template running just xpc_main().
If you're not already doing so, you may want to try having your app using "beginActivityWithOptions" to ensure that it's remaining active.
I tried this both in application and xpc service and it didn't had any effect. I even tried task_policy, setting main thread to user interactive.
Particularly on a old system like this, you may find that periodically "resetting" the message (say, every minute) works better than simply holding the same message "forever".
I tried exactly this and it works. I was sending the reply block only at the start of the application to kickstart the service and boost it. Sending the block again before I want a playback seems to fix the priority problem on Monterey and doesn't have any side effects on newer systems.
I still have a question though. Is there any recommendation how to investigate xpc service priorities (or QoS in general)? I tried launchctl print pid/13422/com.my.service and it gives handful of information but nothing I could figure out the boosting was not working correctly (spawn type seems to reflect only the startup priority). Also in Instruments I was using time profiler, system trace etc. and it shown the correct application lifecycle ("Foreground") but sound was still broken.