Don't process reqeued MPV commands (#633)

## Description
This is an embarrassing bug... In #619, a change was made to avoid a
race condition and wait for the video output surface to be ready by
re-enqueuing commands. Except I missed cancelling executing the current
command.

This meant the command would both be executed and queued again. So, if
attaching the video surface takes a while, such as needing to wait for a
refresh rate change, _a lot_ of commands could have been added to the
queue and trigger a constant start-stop playback loop.

I think technically it would eventually resolve itself, but can take a
while.

### Related issues
Should fix #626
This commit is contained in:
Ray 2026-01-04 17:25:43 -05:00 committed by GitHub
parent 02d6a98ba8
commit 4f1c730736
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -848,7 +848,8 @@ class MpvPlayer(
// Note: this means nothing will play until it is attached to a surface, // Note: this means nothing will play until it is attached to a surface,
// so MpvPlayer can't be used for background audio/music playback // so MpvPlayer can't be used for background audio/music playback
Timber.v("MPV is not initialized/attached yet, requeue cmd %s", cmd) Timber.v("MPV is not initialized/attached yet, requeue cmd %s", cmd)
internalHandler.sendMessageDelayed(Message.obtain(msg), 50) internalHandler.sendMessageDelayed(Message.obtain(msg), 250)
return true
} }
when (cmd) { when (cmd) {
MpvCommand.PLAY_PAUSE -> { MpvCommand.PLAY_PAUSE -> {