Commit graph

233 commits

Author SHA1 Message Date
Arun Raghavan
f0bdec32c1 pulsesink: Deal with not being able to convert a format to caps
It is possible that PulseAudio adds formats that are not yet supported
in pulsesink, and in those cases, we want to gracefully skip them rather
than cause an assert on a NULL caps.
2019-02-06 15:33:31 +05:30
Arun Raghavan
4e9a8e5883 Revert "pulsesrc: Move to extended stream API"
This reverts commit 4d67d1bd16.

Using the extended API for the capture path depends on a fix in
PulseAudio
(https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/49).

Until then, let's go back to the standard API.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/552
2019-01-18 11:06:38 +00:00
Arun Raghavan
4d67d1bd16 pulsesrc: Move to extended stream API
This is needed as a precursor to allowing capture of IEC61937
formats. We now also need to include the channel map while converting
format info to caps so that a correct channel mask is generated for
pulsesrc's caps.
2019-01-10 09:16:02 +00:00
Arun Raghavan
a24ef929a4 pulse: Expose the correct max rate that we support
PulseAudio defines PA_RATE_MAX as the maximum sampling rate that it
supports. We were previously exposing a maximum rate of INT_MAX, which
is incorrect, but worked because nothing was really using a rate greater
than 384000 kHz.

While playing DSD data, we hit a case where there might be very high
sample rates (>1MHz), and pulsesink fails during stream creation with
such streams because it erroneously advertises that it supports such
rates.

Since PA_RATE_MAX is #define'd to (8*48000U), we can't just use it in
the caps string. Instead, we fix up the rate to what we actually support
whenever we use our macro caps.
2018-11-19 21:28:25 +05:30
Jan Schmidt
46a3c9ac8b Revert "pulsesink: uncork if needed upon commit"
This reverts commit 0dd46accf6.

With some audiosinks, starting the ringbuffer on the first commit
causes audio glitches at startup by starting to output segments
from the ringbuffer before it has been filled / fully prerolled. This
doesn't usually happen with pulsesink because we map the pulseaudio
ringbuffer directly, but we should keep things consistent with
other sinks with regards to startup latency, plus it gives more
headway to avoid glitching, should the initial 2nd segment take
more than 10ms to generate.

https://bugzilla.gnome.org/show_bug.cgi?id=657076
2016-04-16 02:21:14 +10:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Arun Raghavan
3751c87f00 pulsesink: Make sure to filter caps in all cases during CAPS query
We were skipping the filter step while returning template caps, for
example.
2015-03-09 11:55:40 +05:30
Jimmy Ohn
f9a8f0ebfe pulsesink: Enhance code readability in pulsesink_query
In pulsesink_query function, we use a switch for the query
type. In the CAPS case, there is no 'break', instead we
return right away. Use a break and return at the end of
the function instead for better code readability.

https://bugzilla.gnome.org/show_bug.cgi?id=744461
2015-02-13 22:27:49 +00:00
Jimmy Ohn
bf10d33b9b pulsesink: Free format_info in query_getcaps
If we can not create probe stream in query_getcaps function, it will appear
memory leakage from format info.
The following patch prevent memory leakage in pulsesink.

https://bugzilla.gnome.org/show_bug.cgi?id=743178
2015-01-26 12:07:20 -03:00
Mark Nauwelaerts
0dd46accf6 pulsesink: uncork if needed upon commit
... to provide for a running clock.
2015-01-10 13:04:44 +01:00
Arun Raghavan
163155715f pulsesink: Temporarily disable stream status posting
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
2014-10-22 23:12:38 +05:30
Arun Raghavan
2a3adec2f7 pulse: Add some documentation about threading and synchronisation
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.
2014-09-30 06:28:50 +05:30
Arun Raghavan
0ed08ac3fd pulsesink: Make emitting stream status messages synchronous
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
2014-09-30 06:28:50 +05:30
Olivier Crête
e714ab9dba pulse: Make gst_pulse_format_info_to_caps() shared
https://bugzilla.gnome.org/show_bug.cgi?id=678402
2014-03-16 15:28:29 +00:00
Stefan Sauer
3abad7af66 pulsesink: fix crash when getting the current-device in NULL->READY
The "goto unlock" is wrong as in this code path we haven't take the lock yet.
Fixes #724619
2014-02-18 11:28:18 +01:00
Olivier Crête
dc782af133 pulsesink: Free device_info in accepts caps
https://bugzilla.gnome.org/show_bug.cgi?id=719811
2013-12-04 16:24:06 -05:00
Tim-Philipp Müller
d506409af5 docs: get rid of 'Since: 0.10.x' markers
And some gtk-doc markup fixes.
2013-11-18 14:47:35 +00:00
Olivier Crête
e00b8f0a4a pulsesink: Add property to find out the device currently in use
https://bugzilla.gnome.org/show_bug.cgi?id=590768
2013-08-22 15:03:29 -04:00
Olivier Crête
d379e237c1 pulsesink: De-duplicate code to get the current sink input info
https://bugzilla.gnome.org/show_bug.cgi?id=590768
2013-08-22 14:37:28 -04:00
Olivier Crête
8f9fbfa992 pulsesink: Implement changing the device while playing
https://bugzilla.gnome.org/show_bug.cgi?id=590768
2013-08-22 14:25:30 -04:00
Akihiro Tsukada
fda72021d2 pulsesink: Add support for AAC pass-through
https://bugzilla.gnome.org/show_bug.cgi?id=694445
2013-08-21 21:48:56 +02:00
Olivier Crête
db84b928a3 pulse: Share static caps definition between src and sink
The src was also missing 24-bit sample formats
2013-08-21 15:23:12 -04:00
Olivier Crête
dd5d93f0f6 pulse: Remove unused GstPulseProbe 2013-08-19 12:56:27 -04:00
Arun Raghavan
7486e2fc53 Revert "pulsesink: Make 2.0 dependency optional"
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.
2013-06-13 14:23:08 +05:30
Arun Raghavan
01457027e0 pulsesink: Make 2.0 dependency optional
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
2013-06-13 12:44:32 +05:30
Arun Raghavan
c7e65777e1 pulsesink: Cache the getcaps/acceptcaps probe stream
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
2013-06-10 13:05:43 +05:30
Arun Raghavan
14e784f9fc pulsesink: Add a getcaps function
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
2013-06-10 13:05:24 +05:30
Arun Raghavan
84238d3ea4 pulsesink: Take a lock on the ringbuffer in acceptcaps
This is needed as a concurrent state change could pull the context or
stream out from under our feet.

https://bugzilla.gnome.org/show_bug.cgi?id=686459
2013-06-10 13:05:16 +05:30
Arun Raghavan
e5fad95306 pulsesink: Get rid of acceptcaps side-effects
The sink info callback should not have side-effects on the GstPulseSink
object since we are sometimes using with a dummy stream in acceptcaps.

https://bugzilla.gnome.org/show_bug.cgi?id=686459
2013-06-06 16:15:48 +05:30
Arun Raghavan
cc5562a8d9 pulsesink: Better error message when server version is too old
We check for the library version at configure time, but the server
version can only really be checked at run-time.

https://bugzilla.gnome.org/show_bug.cgi?id=698768
2013-04-29 11:54:26 +05:30
Stefan Sauer
33752425e7 pulsesink: add a little more docs to the audioclock 2013-04-11 20:47:18 +02:00
Arun Raghavan
35f3bea558 pulsesink: Update segdone periodically
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
2013-02-23 09:26:19 +05:30
Tim-Philipp Müller
0c9b039c22 pulsesink: don't error out if pa_stream_proplist_update() with new tags fails
Shouldn't really happen these days, but if it does, it's not really
a problem either.

https://bugzilla.gnome.org/show_bug.cgi?id=656068
2013-01-19 13:27:48 +00:00
Sebastian Dröge
0726b71ceb ext/sys: Fix some compilation errors caused by circular includes 2012-12-12 17:35:04 +00:00
Sebastian Dröge
5e9adc4936 pulse: Use new GType for GThread instead of just G_TYPE_POINTER 2012-11-12 11:47:43 +01:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Sebastian Dröge
69246dfef7 pulsesink: Flush the ringbuffer on GAP events without duration
This is required to properly start the ringbuffer and clock.
2012-10-24 11:19:52 +02:00
Tim-Philipp Müller
5ab46eff83 pulsesink: fix caps leak in acceptcaps function 2012-10-20 11:32:27 +01:00
Tim-Philipp Müller
d2fdc26c38 pulsesink: in accept_caps() check if ring buffer is NULL before de-referencing
And sprinkle some thread-safety (take object lock for
accessing ring buffer, and pa main loop lock for the
context).

https://bugzilla.gnome.org/show_bug.cgi?id=683782
2012-10-19 15:11:07 +01:00
Arun Raghavan
f46475ee37 pulsesink: Specify endianness in IEC 61937 payloading
Corresponds to an API change in gst-plugins-base.

https://bugzilla.gnome.org/show_bug.cgi?id=678021
2012-09-19 09:18:19 +05:30
Wim Taymans
148ab7539b pulse: improve debug 2012-09-06 10:43:52 +02:00
Tim-Philipp Müller
4bb52bbadf docs: gst-launch -> gst-launch-1.0 and ffmpegcolorspace -> videoconvert 2012-08-27 21:20:30 +01:00
Wim Taymans
373333c2b3 pulsesink: improve debug 2012-04-25 10:29:45 +02:00
Wim Taymans
c0140982ee pulsesink: start unmuted when requested
When we explicitely set the mute property to FALSE, connect to pulseaudio with
the PA_STREAM_START_UNMUTED flag set, otherwise pulseaudio will use its
previously used value (which might start the stream muted).

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=672401
2012-04-25 10:29:45 +02:00
Sebastian Dröge
d99eb6d2cb Update everything for the removal of the interface library and mixer/tuner interfaces 2012-04-13 13:15:11 +02:00
Tim-Philipp Müller
e09ae5736d Use new gst_element_class_set_static_metadata() 2012-04-10 00:51:41 +01:00
Sebastian Dröge
0b517ce9fb Merge branch '0.11' of ssh://git.freedesktop.org/git/gstreamer/gst-plugins-good into 0.11 2012-01-25 12:49:34 +01:00
Sebastian Dröge
10554b271f Merge branch 'master' into 0.11
Conflicts:
	ext/flac/gstflacdec.c
	ext/jpeg/gstjpegenc.c
	ext/pulse/pulsesink.c
	sys/v4l2/gstv4l2src.c
2012-01-25 12:49:11 +01:00
Wim Taymans
b4630dd3e0 more memory API porting 2012-01-25 12:30:29 +01:00
Mark Nauwelaerts
3168b77e04 pulsesink: additional error condition checking 2012-01-20 17:10:14 +01:00