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

decomp: fix potential deadlock at EOF

The decompression process needs to "see" the end-of-file. Otherwise
it might get stuck, and then the demux thread will get stuck too.
Closing the write end of the pipe to the compression process fixes

Pointed-out-by: Laurent Aimar
parent 40cc1302
......@@ -148,6 +148,9 @@ static void *Thread (void *data)
while (!error);
msg_Dbg (stream, "compressed stream at EOF");
/* Let child process know about EOF */
p_sys->write_fd = -1;
close (fd);
return NULL;
......@@ -364,7 +367,9 @@ static void Close (vlc_object_t *obj)
vlc_cancel (p_sys->thread);
close (p_sys->read_fd);
vlc_join (p_sys->thread, NULL);
close (p_sys->write_fd);
if (p_sys->write_fd != -1)
/* Killed before EOF? */
close (p_sys->write_fd);
msg_Dbg (obj, "waiting for PID %u", (unsigned)p_sys->pid);
while (waitpid (p_sys->pid, &status, 0) == -1);
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