Skip to content

player/playloop: handle force window in playloop#17212

Merged
kasper93 merged 1 commit intompv-player:masterfrom
na-na-hi:force-window-fix
Jan 7, 2026
Merged

player/playloop: handle force window in playloop#17212
kasper93 merged 1 commit intompv-player:masterfrom
na-na-hi:force-window-fix

Conversation

@na-na-hi
Copy link
Copy Markdown
Contributor

813c112 moved force window to option callback. This happens before the loading of the file has finished (which is supposed to trigger handle_force_window) so it is too early to handle certain cases, such as loading of album art failed and therefore window will never be created because there is no video track.

Adding force window check in playloop to make sure window is always initialized after file loading is complete.

Fixes: 813c112
Fixes: #17209

813c112 moved force window to option
callback. This happens before the loading of the file has finished
(which is supposed to trigger handle_force_window) so it is too early to
handle certain cases, such as loading of album art failed and therefore
window will never be created because there is no video track.

Adding force window check in playloop to make sure window is always
initialized after file loading is complete.

Fixes: 813c112
@guidocella
Copy link
Copy Markdown
Contributor

Can we call it only in load_external_opts_thread (with force)? It does fix that bug.

Also funny how in this situation mpv plays in the terminal but OSD messages and scripts don't get printed because it presumably tries to output to a window.

@na-na-hi
Copy link
Copy Markdown
Contributor Author

Can we call it only in load_external_opts_thread (with force)? It does fix that bug.

It only handles external files which is not enough for correct operation of handle_force_window:

mpv/player/playloop.c

Lines 1026 to 1028 in f57c5ca

// True if we're either in idle mode, or loading of the file has finished.
// It's also set via force in some stages during file loading.
bool act = mpctx->stop_play || mpctx->playback_initialized || force;

Correct solution must make sure mpctx->playback_initialized is checked again after its value is changed.

@kasper93
Copy link
Copy Markdown
Member

kasper93 commented Jan 7, 2026

LGTM, thanks!

@kasper93 kasper93 merged commit 39e5d29 into mpv-player:master Jan 7, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audio file is played without mpv window if cover.jpg in same directory is empty/corrupted

3 participants