Skip to content

vo: always set request_redraw when player is paused#18118

Open
seishun wants to merge 1 commit into
mpv-player:masterfrom
seishun:redraw-paused
Open

vo: always set request_redraw when player is paused#18118
seishun wants to merge 1 commit into
mpv-player:masterfrom
seishun:redraw-paused

Conversation

@seishun

@seishun seishun commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This fixes a rare race condition where render_frame clears
request_redraw right before the player is paused.

This fixes a rare race condition where render_frame clears
request_redraw right before the player is paused.
@Dudemanguy

Copy link
Copy Markdown
Member

Do you have a way to reproduce the race in question? I don't mind if I have to run it a bazillion times to see it.

@seishun

seishun commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Load a video with this script and seek a few seconds before the end:

function on_eof_reached(name, value) {
    if (value == true) {
        mp.osd_message("finished watching");
    }
}
mp.observe_property("eof-reached", "bool", on_eof_reached);

@Dudemanguy

Dudemanguy commented Jun 16, 2026

Copy link
Copy Markdown
Member

Hmm not seeing anything. I'm seeking one second from the end and I presume the race would eventually show finished watching, but that isn't coming up. But the player doesn't pause in this test so I'm not sure how it would be an example of the race in the first place?

@seishun

seishun commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

The player pauses when the end of playback is reached (with --keep-open enabled). That should show the message, which the race prevents.

@Dudemanguy

Copy link
Copy Markdown
Member

So the test I'm doing is this with --keep-open:

function on_eof_reached(name, value)
    if value == true then
        mp.osd_message("finished watching");
        mp.commandv("seek", "-1", "exact")
    end
end

mp.observe_property("eof-reached", "bool", on_eof_reached);

And so far I've seen the message every time.

@seishun

seishun commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Right, because seeking causes a redraw. Try this:

function on_eof_reached(name, value)
    if value == true then
        mp.osd_message("finished watching")
        mp.add_timeout(1, function()
            mp.commandv("seek", "-1", "exact")
            mp.set_property("pause", "no")
        end)
    end
end

mp.observe_property("eof-reached", "bool", on_eof_reached)

@Dudemanguy

Copy link
Copy Markdown
Member

Ran that for a few minutes but I still see the message every time. Does that script show the race for you?

@seishun

seishun commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

It does but not with every video. I can reproduce the race with this one, for instance: https://x.com/mushokutensei_A/status/2062482077174677970

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.

2 participants