We need a mechanism in PulseAudio to allow running code outside the
mainloop lock. Then we'd be able to post to the bus (taking the
GST_OBJECT_LOCK), without worrying about locking order with the mainloop
lock, which is the current cause of deadlocks while trying to post the
stream status messages.
https://bugzilla.gnome.org/show_bug.cgi?id=736071
This gives a quick introduction to how the pulsesink/pulsesrc code
interacts with the pa_threaded_mainloop that we start up to communicate
with the server.
The stream status messages are emitted in the PA mainloop thread, which
means the mainloop lock is taken, followed by the Gst object lock (by
gst_element_post_message()). In all other locations, the order of
locking is reversed (this is unavoidable in a bunch of cases where the
object lock is taken by GstBaseSink or GstAudioBaseSink, and then we get
control to take the mainloop lock).
The only way to guarantee that the defer callback for stream status
messages doesn't deadlock is to either stop posting those messages, or
make sure that the message emission is completed before we proceed to
any point that might take the object lock before the mainloop lock
(which is what we do after this patch).
https://bugzilla.gnome.org/show_bug.cgi?id=736071
The audio library considers them as encoded formats and does not fill in the
sample width. The audio ringbuffers identifies the format as alaw/mulaw and that
is always 8 bits.
This reverts commit 01457027e0.
We'll just depend on PulseAudio 2.0 or above instead of having the bug
partially fixed based on the installed libpulse version.
The getcaps function we added uses some pa_format_info_get_prop...
accessor functions that were only added in 2.0, so we only have our
getcaps implementation exist if we're compiling against libpulse 2.0 or
above.
Eventually, we could bump the minimum requirement to 2.0 or above.
https://bugzilla.gnome.org/show_bug.cgi?id=686459
getcaps is called frequently during stream setup, and creating a new
stream each time is very inefficient. There's some more room for
optimisation by caching the queried sink formats as well, but this needs
some more changes to listen for format changes on the sink (for when
supported formats change between probe stream creation and sink
querying).
https://bugzilla.gnome.org/show_bug.cgi?id=686459
This allows us to have more fine-tuned caps in READY or above. However,
this is _really_ inefficient since we create a new stream and query sink
for every getcaps in READY, which on a simple gst-launch line happens
about 35 times. The next step is to cache getcaps results.
https://bugzilla.gnome.org/show_bug.cgi?id=686459
This makes sure that we update segdone based on the read index received
during latency updates. As the comment notes, we make some compromises
to deal with the fact that segdone is a segment multiple, while the read
index offers finer granularity. The updates are also not very often
(100ms since that is how often automatic timing updates are provided).
All this is required for the baseaudiosink sample alignment code to work
at all.
https://bugzilla.gnome.org/show_bug.cgi?id=694257
A bug in PulseAudio causes PA_STREAM_START_MUTED to be rejected on
record streams. Until this is fixed upstream, we mute the stream
manually at startup. Based on a patch by Alban Browaeys
<prahal@yahoo.com>.
https://bugzilla.gnome.org/show_bug.cgi?id=684469
When we start and renegotiate, there is a moment where the stream is created but
not yet connected. Make sure all functions deal with this situation correctly
instead of erroring out.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=681247