You are absolutely correct. I have been corking/flushing the stream outside of my mainloop thread that calls pa_mainloop_run(). Are the callbacks for actions like stream reads and writes executing in my thread that is running my mainloop or in a server thread? > On Apr 23, 2016, at 4:26 AM, Tanu Kaskinen <tanuk at iki.fi> wrote: > >> On Wed, 2016-04-20 at 21:30 +0000, John Promersberger wrote: >> Noob. >> >> >> I thought my code was doing really well, but it has started to >> terminate on the mainloop assertion where the number of deferred >> events is greater than 0 (mainloop.c: ~280 if I remember correctly). >> Looks like it is in mainloop->defer_enable(). Seems to mostly occur >> when I'm corking/fllushing/disconnecting/decrementing reference count >> of a stream. After I tear down the stream, I build a different >> stream to play a different sound. I've since taken out the corking >> of the stream. >> >> >> I couldn't find anything useful to read regarding this. I'm not >> creating an deferred events explicitly myself. >> >> >> >> Any ideas that could resolve this? > > Do you have multiple threads by any chance? I've seen that kind of an > assertion with code that accessed the mainloop from multiple threads. > libpulse is not thread-safe, so accessing libpulse objects from > multiple threads is not supported (unless you yourself implement the > necessary locking to make it safe). > > -- > Tanu > _______________________________________________ > pulseaudio-discuss mailing list > pulseaudio-discuss at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss