Commit 2e09a58d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

PulseAudio: clear all stream callbacks before disconnection

This should fix the infrequent assertions failures at exit.
parent c6b07475
...@@ -831,30 +831,20 @@ static void Close (vlc_object_t *obj) ...@@ -831,30 +831,20 @@ static void Close (vlc_object_t *obj)
/* The callback takes mainloop lock, so it CANNOT be held here! */ /* The callback takes mainloop lock, so it CANNOT be held here! */
var_DelCallback (aout, "audio-device", StreamMove, s); var_DelCallback (aout, "audio-device", StreamMove, s);
var_Destroy (aout, "audio-device"); var_Destroy (aout, "audio-device");
}
vlc_pa_lock(); pa_stream_disconnect(s);
if (s != NULL) {
pa_operation *op;
if (pa_stream_is_corked(s) > 0) /* Clear all callbacks */
/* Stream paused: discard all buffers */ pa_stream_set_state_callback(s, NULL, NULL);
op = pa_stream_flush(s, stream_success_cb, NULL); pa_stream_set_latency_update_callback(s, NULL, aout);
else pa_stream_set_moved_callback(s, NULL, aout);
/* Stream playing: wait until buffers are played */ pa_stream_set_overflow_callback(s, NULL, aout);
op = pa_stream_drain(s, stream_success_cb, NULL); pa_stream_set_started_callback(s, NULL, aout);
if (likely(op != NULL)) { pa_stream_set_suspended_callback(s, NULL, aout);
#ifdef LIBPULSE_GETS_A_CLUE pa_stream_set_underflow_callback(s, NULL, aout);
while (pa_operation_get_state(op) == PA_OPERATION_RUNNING)
vlc_pa_wait();
#endif
pa_operation_unref(op);
}
pa_stream_disconnect(s);
pa_stream_unref(s); pa_stream_unref(s);
} }
vlc_pa_unlock();
vlc_pa_disconnect(obj, ctx); vlc_pa_disconnect(obj, ctx);
free(sys); free(sys);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment