Re: [pulseaudio-discuss] Packagers: Xlib vs XCB
On Mon, 16 Aug 2010 14:51:48 +0100, Colin Guthrie gm...@colin.guthr.ie wrote: As some of you will have found out, there are some applications that have problems relating to Xlib usage (XCloseDisplay() IIRC) when combined with PA client libs (notably I've seen reports from VLC relating to this). VLC media player proper works fine with Xlib and PulseAudio (although it wouldn't to have a PulseAudio expert look at the PulseAudio support). The Xlib problem can manifest itself in two different ways: * If a process calls XInitThreads() _after_ XOpenDisplay(), then XCloseDisplay() will crash trying to acquire a non-existent mutex. This is typical if you use LibVLC but fail to call XInitThreads() early in your main() function. * If a multi-thread process uses Xlib from more than one thread but never calls XInitThreads(), then depending on the phase of the moon, then race conditions might trigger crashes (typically in the form of heap corruption in my experience) depending on the phase of the moon. As regards PulseAudio, the issue comes up if libpulse is used from a different thread than Xlib. Calling XInitThreads() from main is the official solution. Unfortunately, there are many scenarii where this does not work. You might not have control over the main() function (e.g. the VLC plugin for Mozilla). Also Xlib might be hidden deep beneath frameworks that do not call XInitThreads, such as GTK or Qt. Since libpulse does not really need any Xlib feature not found in XCB, I humbly think switching to XCB is the best choice. XCB is thread-safe by default. Thank you for that. -- Rémi Denis-Courmont http://www.remlab.net http://fi.linkedin.com/in/remidenis ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Packagers: Xlib vs XCB
'Twas brillig, and Rémi Denis-Courmont at 17/08/10 09:00 did gyre and gimble: On Mon, 16 Aug 2010 14:51:48 +0100, Colin Guthrie gm...@colin.guthr.ie wrote: As some of you will have found out, there are some applications that have problems relating to Xlib usage (XCloseDisplay() IIRC) when combined with PA client libs (notably I've seen reports from VLC relating to this). VLC media player proper works fine with Xlib and PulseAudio (although it wouldn't to have a PulseAudio expert look at the PulseAudio support). The Xlib problem can manifest itself in two different ways: * If a process calls XInitThreads() _after_ XOpenDisplay(), then XCloseDisplay() will crash trying to acquire a non-existent mutex. This is typical if you use LibVLC but fail to call XInitThreads() early in your main() function. * If a multi-thread process uses Xlib from more than one thread but never calls XInitThreads(), then depending on the phase of the moon, then race conditions might trigger crashes (typically in the form of heap corruption in my experience) depending on the phase of the moon. As regards PulseAudio, the issue comes up if libpulse is used from a different thread than Xlib. Calling XInitThreads() from main is the official solution. Unfortunately, there are many scenarii where this does not work. You might not have control over the main() function (e.g. the VLC plugin for Mozilla). Also Xlib might be hidden deep beneath frameworks that do not call XInitThreads, such as GTK or Qt. Since libpulse does not really need any Xlib feature not found in XCB, I humbly think switching to XCB is the best choice. XCB is thread-safe by default. Thank you for that. Thanks Rémi for the detailed description :) Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] Packagers: Xlib vs XCB
Hi, As some of you will have found out, there are some applications that have problems relating to Xlib usage (XCloseDisplay() IIRC) when combined with PA client libs (notably I've seen reports from VLC relating to this). I've therefore committed a patch I wrote a while back to stable-queue that ports the client side code to XCB. I've been using this for a while and not noticed any regressions so I think it's good for s-q. I want to push it on master too, but there was some extra code added there that deals with multiple screens. I'm waiting for a reply on ticket 799 to see if this can be mangled into my port, but if I don't get one soon, I'll just clobber it with my code and the missing functionality can be added back in later (it's a pretty niche use case IIRC). So if you package s-q, don't forget to add a build require on XCB-devel package if you want X11 support :) Cheers Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss