summaryrefslogtreecommitdiff
blob: 3163410353a22c3feb52ca87335904c2d8b5e16c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
index 2debbcd..72e7fcf 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -472,8 +472,17 @@ static void stream_underflow_cb(pa_stream *s, void *userdata)
 {
+    uint32_t rate = pa_stream_get_sample_spec(s)->rate;
     audio_output_t *aout = userdata;
 
-    msg_Dbg(aout, "underflow");
-    (void) s;
+    msg_Warn(aout, "underflow");
+    stream_stop(s, aout);
+
+    aout_sys_t *sys = aout->sys;
+    sys->first_pts = VLC_TS_INVALID;
+
+    pa_operation *op = pa_stream_update_sample_rate(s, rate, NULL, NULL);
+    if (unlikely(op == NULL))
+        return;
+    pa_operation_unref(op);
 }
 
 static int stream_wait(pa_stream *stream, pa_threaded_mainloop *mainloop)