rendering: set high priority

This commit is contained in:
Bixilon 2022-02-20 19:33:52 +01:00
parent c3e3bdc9ac
commit 36fd3a8f8f
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -59,6 +59,7 @@ class Rendering(private val connection: PlayConnection) {
val audioLatch = CountUpAndDownLatch(1, latch) val audioLatch = CountUpAndDownLatch(1, latch)
Thread({ Thread({
try { try {
Thread.currentThread().priority = Thread.MAX_PRIORITY
audioPlayer.init(audioLatch) audioPlayer.init(audioLatch)
audioPlayer.startLoop() audioPlayer.startLoop()
audioPlayer.exit() audioPlayer.exit()
@ -80,6 +81,7 @@ class Rendering(private val connection: PlayConnection) {
private fun startRenderWindow(latch: CountUpAndDownLatch) { private fun startRenderWindow(latch: CountUpAndDownLatch) {
try { try {
Thread.currentThread().priority = Thread.MAX_PRIORITY
CONTEXT_MAP[Thread.currentThread()] = renderWindow CONTEXT_MAP[Thread.currentThread()] = renderWindow
renderWindow.init(latch) renderWindow.init(latch)
renderWindow.startLoop() renderWindow.startLoop()