mirror of
https://github.com/mpv-player/mpv
synced 2025-02-06 15:11:58 +00:00
ao_wasapi0: Don't starve the WASAPI thread on seeks
Seeking calls thread_reset, but doesn't call thread_play. thread_reset would disable WASAPI events, but they would never get re-enabled unless the user paused and then unpaused. Keep track of whether the stream is paused or not (there already was a field for that, but it was apparently unused), and if it's not paused, call thread_play after thread_reset. Fixes mpv freezing after seeks.
This commit is contained in:
parent
20c2947cbb
commit
d0b129971a
@ -430,15 +430,10 @@ exit_label:
|
||||
|
||||
static void thread_pause(wasapi0_state *state)
|
||||
{
|
||||
state->is_playing = 0;
|
||||
IAudioClient_Stop(state->pAudioClient);
|
||||
}
|
||||
|
||||
static void thread_reset(wasapi0_state *state)
|
||||
{
|
||||
IAudioClient_Stop(state->pAudioClient);
|
||||
IAudioClient_Reset(state->pAudioClient);
|
||||
}
|
||||
|
||||
/* force_feed - feed in even if available data is smaller than required buffer, to clear the buffer */
|
||||
static void thread_feed(wasapi0_state *state,int force_feed)
|
||||
{
|
||||
@ -477,10 +472,20 @@ exit_label:
|
||||
static void thread_play(wasapi0_state *state)
|
||||
{
|
||||
thread_feed(state, 0);
|
||||
state->is_playing = 1;
|
||||
IAudioClient_Start(state->pAudioClient);
|
||||
return;
|
||||
}
|
||||
|
||||
static void thread_reset(wasapi0_state *state)
|
||||
{
|
||||
IAudioClient_Stop(state->pAudioClient);
|
||||
IAudioClient_Reset(state->pAudioClient);
|
||||
if (state->is_playing) {
|
||||
thread_play(state);
|
||||
}
|
||||
}
|
||||
|
||||
static void thread_getVol(wasapi0_state *state)
|
||||
{
|
||||
IAudioEndpointVolume_GetMasterVolumeLevelScalar(state->pEndpointVolume,
|
||||
|
Loading…
Reference in New Issue
Block a user