summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2013-07-19 13:06:14 -0300
committerwm4 <wm4@nowhere>2013-07-20 02:21:04 +0200
commitd0b129971a934bf499c478ea52fcd6051713ae19 (patch)
treecef44a4396cbb77e8549b5a1b1652d82f0909888
parent20c2947cbb37cfd616986960b3b2cd743815d96b (diff)
downloadmpv-d0b129971a934bf499c478ea52fcd6051713ae19.tar.bz2
mpv-d0b129971a934bf499c478ea52fcd6051713ae19.tar.xz
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.
-rw-r--r--audio/out/ao_wasapi0.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/audio/out/ao_wasapi0.c b/audio/out/ao_wasapi0.c
index 6a3bfc943c..11303ddde1 100644
--- a/audio/out/ao_wasapi0.c
+++ b/audio/out/ao_wasapi0.c
@@ -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,