[pulseaudio-tickets] [Bug 39459] New: Draining playback stream never completes
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Jul 21 12:47:21 PDT 2011
https://bugs.freedesktop.org/show_bug.cgi?id=39459
Summary: Draining playback stream never completes
Product: PulseAudio
Version: unspecified
Platform: x86 (IA32)
OS/Version: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: clients
AssignedTo: pulseaudio-bugs at lists.freedesktop.org
ReportedBy: courmisch at gmail.com
QAContact: pulseaudio-bugs at lists.freedesktop.org
CC: lennart at poettering.net
I might have missed something obvious but there seems to be a race condition
resulting in a deadlock in libpulse 0.9.22 (Debian).
I have stream with prebuf disabled (zero). When the Close() function below
gets called, if the stream is not corked, the pa_stream_drain() callback
never gets called, so pa_threaded_mainloop_wait() never returns and the whole
process jams.
This seems timing dependent: if I put a gdb breakpoint on
pa_operation_get_state() then continue, the callback does get called and the
process does not get stuck on the condition variable. There is also no problem
if the stream is corked, in which case we use pa_stream_flush() instead of
pa_stream_drain().
The code follows:
static void stream_success_cb(pa_stream *s, int success, void *userdata)
{
pa_threaded_mainloop *mainloop = userdata;
fprintf(stderr, "DONE: %d\n", success);
pa_threaded_mainloop_signal(mainloop, 0);
(void) s;
(void) success;
}
/* ... */
static void Close(vlc_object_t *obj)
{
aout_instance_t *aout = (aout_instance_t *)obj;
aout_sys_t *sys = aout->output.p_sys;
pa_threaded_mainloop *mainloop = sys->mainloop;
pa_context *ctx = sys->context;
pa_stream *s = sys->stream;
/* ... */
pa_threaded_mainloop_lock(mainloop);
if (s != NULL) {
pa_operation *op;
if (pa_stream_is_corked(s) > 0)
/* Stream paused: discard all buffers */
op = pa_stream_flush(s, stream_success_cb, mainloop);
else
/* Stream playing: wait until buffers are played */
op = pa_stream_drain(s, stream_success_cb, mainloop);
if (likely(op != NULL)) {
while (pa_operation_get_state(op) == PA_OPERATION_RUNNING) {
fprintf(stderr, "waiting\n");
pa_threaded_mainloop_wait(mainloop);
}
pa_operation_unref(op);
}
pa_stream_disconnect(s);
pa_stream_unref(s);
}
if (ctx != NULL)
pa_context_unref(ctx);
pa_threaded_mainloop_unlock(mainloop);
pa_threaded_mainloop_free(mainloop);
free(sys);
}
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the pulseaudio-bugs
mailing list