Commit graph

194 commits

Author SHA1 Message Date
Arun Raghavan
a7790efd04 pulse: Get caps correctly on pad block
Instead of always going upstream, we should first see if already got
caps from a setcaps() call.

https://bugzilla.gnome.org/show_bug.cgi?id=661262
2011-10-18 20:02:55 +05:30
Wim Taymans
6de67bb014 pulsesink: only use is_pcm for 1.0 of pulseaudio 2011-10-18 12:05:01 +02:00
Wim Taymans
0ade1a5822 pulsesink: only disable trickmodes for !pcm
Only disable trickmodes when we are not dealing with raw PCM samples.
2011-10-18 11:58:57 +02:00
Arun Raghavan
8ca420f547 pulse: New pulseaudiosink element to handle format changes
This introduces a new bin which wraps around pulsesink and depending on
the formats supported by the sink, plugs in/out a decodebin2 as
required. This allows users to switch sinks on the stream and adapts
accordingly (for example, you could watch a movie in passthrough mode on
your receiver which supports AC3 decode, then plug out and switch to a
non-digital profile to continue uninterrupted on analog output).

The bin is required because doing the same with playbin2/playsink will
require API changes that cannot be made in 0.10. With 0.11/1.0, we
should be able to ask for upstream caps renegotiation to deal with all
this.

https://bugzilla.gnome.org/show_bug.cgi?id=657179
2011-09-19 07:43:04 +05:30
Arun Raghavan
bd604175c5 pulsesink: Trivial indentation fix 2011-08-23 22:48:34 +05:30
David Henningsson
e70020b456 pulsesink: Allow writes in bigger chunks
There's no use in splitting the incoming data down to the segsize
limit - by writing as much as possible in one chunk, we increase
performance and avoid PulseAudio unnecessary rewinds.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-08-19 09:48:27 +02:00
Tim-Philipp Müller
25ace0e524 pulsesink: fix variable-set-but-not-used compiler warning with older pulse versions 2011-07-29 13:05:42 +01:00
Arun Raghavan
ac7cad431c pulsesink: Add support for compressed formats
This adds support for various compressed formats (AC3, E-AC3, DTS and
MP3) payloaded in IEC 61937 format (used for transmission over S/PDIF,
HDMI and Bluetooth).

The acceptcaps() function allows bins to probe for what formats the sink
being connected to support. This only works after the element is set to
at least READY.

If the underlying sink changes and the format we are streaming is not
available, we emit a message that will allow upstream elements/bins to
block and renegotiate a new format.
2011-07-29 01:25:15 +05:30
Arun Raghavan
a67b536741 pulsesink: Use the extended stream API if available
This uses the new extended API for creating streams. This will allow us
to support compressed formats natively in pulsesink as well.
2011-07-29 01:25:15 +05:30
Arun Raghavan
379049809c pulsesrc: Add a source-output-index property
This exposes the source output index of the record stream that we open
so that clients can use this with the introspection if they want (to
move the stream, for example).
2011-07-29 00:07:52 +05:30
Thiago Santos
14b9fb7be6 pulsesrc: Fix default value leaking
Remember to free the default value of client name, avoiding a
leak
2011-07-18 15:16:01 -03:00
René Stadler
ae87731de5 pulsesink: prevent race condition causing ref leak
Since commit 8bfd80, gst_pulseringbuffer_stop doesn't wait for the
deferred call to be run before returning. This causes a race when
READY->NULL is executed shortly after, which stops the mainloop. This
leaks the element reference which is passed as userdata for the callback
(introduced in commit 7cf996, bug #614765).

The correct fix is to wait in READY->NULL for all outstanding calls to
be fired (since libpulse doesn't provide a DestroyNotify for the
userdata). We get rid of the reference passing from 7cf996 altogether,
since finalization from the callback would anyways lead to a deadlock.

Re-fixes bug #614765.
2011-07-05 16:36:17 +02:00
René Stadler
f8456e2a1a pulsesink: small cleanup of copy-paste code 2011-07-05 16:36:17 +02:00
René Stadler
3589cee762 pulsesink: remove unused member variable and misleading log message
Wim changed it in commit 8bfd80 so that pa_defer_ran is not read
anywhere.

The log message used to annotate a mainloop_wait call which is gone.
2011-07-05 16:36:17 +02:00
David Schleef
f69dcaab58 pulse: Increase ranks to PRIMARY + 10
So that pulsesrc/pulsesink get chosen over other possible PRIMARY
src/sinks by autoaudiosink.  Presumably, if pulse is available, it
is always preferred over another src/sink.

Fixes: #647540.
2011-07-03 19:53:42 -07:00
Arun Raghavan
04786a6d31 pulse: Drop support for PA versions before 0.9.16
This drops support fof PulseAudio versions prior to 0.9.16, which was
released about 1.5 years ago. Testing with very old versions is not
feasible and we don't want to maintain 2 independent code-paths.
2011-06-21 16:47:11 -07:00
Pino Toscano
b52c7ebd19 pulse: Define PATH_MAX if it isn't defined
GNU Hurd for example doesn't define it.
2011-05-16 09:04:31 +02:00
Tim-Philipp Müller
f325935314 pulse, speexenc, rtpgsmpay: don't use g_assert() for error handling
Don't use g_assert() for error handling, even if they're highly unlikely.
Either we *know* that something can't happen, in which case we
should just not handle it, or we think something can happen, but it is
very very unlikely that it will ever happen, in which case we should
handle it like any other error instead of asserting.

g_assert() is best left for conditions we have control of, like checking
internal consistency of our code, not checking return values of external
code.

Fixes a bunch of warnings when compiling with -DG_DISABLE_ASSERT:
gstrtpgsmpay.c: In function 'gst_rtp_gsm_pay_handle_buffer':
gstrtpgsmpay.c:130:17: warning: variable 'rtpgsmpay' set but not used
gstspeexenc.c: In function 'gst_speex_enc_encode':
gstspeexenc.c:904:19: warning: variable 'written' set but not used
pulsesink.c: In function 'gst_pulsesink_change_state':
pulsesink.c:2725:9: warning: variable 'res' set but not used
pulsesrc.c: In function 'gst_pulsesrc_change_state':
pulsesrc.c:1253:7: warning: variable 'e' set but not used
2011-04-16 18:15:43 +01:00
Robert Swain
098cf89e34 jpegenc: pulsesink: raw1394: Address unused but set variables
GCC 4.6.x spits warnings about such usage of variables. The variables in
raw1394 were marked with G_GNUC_UNUSED as this seemed omre appropriate.
The others were removed.
2011-04-16 13:13:04 +01:00
Sebastian Dröge
11bcac7c90 Revert "Pulsesink: Allow chunks up to bufsize instead of segsize"
This reverts commit 1e2c1467ae.

The commit causes pulsesink to ignore the latency-time baseaudiosink property.
2011-04-08 14:35:04 +02:00
Arun Raghavan
dc48eaac13 pulsesink: Always call pa_stream_new_with_proplist()
pa_stream_new_with_proplist() can take a NULL proplist, so we don't need
to concern ourselves with whether it's NULL or not.
2011-04-04 17:23:21 +05:30
Mark Nauwelaerts
176b8ffbff pulsesink: also uncork during EOS waiting (and after EOS is rendered)
Pulsesink was recently changed to defer uncorking until there is data
to write. This condition will however never occur when EOS in being
rendered (since that marks the end of data). Changing to PAUSED state
while EOS is being waited on results in a hang: pausing corks the
stream, which will never be undone since there is no more data when
going back to PLAYING. If pulsesink is the clock provider, deadlock
ensues since time doesn't continue in corked state and the clock id
for EOS wait never fires.

Fixes #645961.
2011-03-31 13:25:19 +02:00
Philip Jägenstedt
84decd731f pulsesink: Better fix for deadlock on failed connect
This reverts the previous fix that would cause a double-unlock when the
stream connect failed.

https://bugzilla.gnome.org/show_bug.cgi?id=644510
2011-03-12 00:48:03 +05:30
Arun Raghavan
387f533a07 pulsesink: Fix deadlock if connecting to PA fails
Commit dd4ec22e introduced a deadlock in the failure path while trying
to connect to PulseAudio. This makes sure we drop the lock on the
resource mutex to avoid this.

https://bugzilla.gnome.org/show_bug.cgi?id=644510
2011-03-11 23:19:34 +05:30
Tim-Philipp Müller
14e1d9de3d docs: fix pulsesink gtk-doc markup 2011-03-11 09:54:36 +00:00
Stefan Kost
89914439b7 pulsesink: add a doc example for setting stream-properties 2011-03-04 15:50:49 +02:00
Stefan Kost
edfa99ef31 pulsesink: fix the xml in the docs 2011-03-04 15:50:49 +02:00
Philip Jägenstedt
dd4ec22e7e pulsesink: release pa_shared_resource_mutex before pa_threaded_mainloop_wait
Not doing so can result in a deadlock when two threads enter
gst_pulseringbuffer_open_device at the same time, as
pa_threaded_mainloop_wait releases the mainloop lock while waiting,
allowing another thread to take it, resulting in a deadlock as two
threads waits for the lock the other is holding.

https://bugzilla.gnome.org/show_bug.cgi?id=643087
2011-02-28 16:20:22 +05:30
Philip Jägenstedt
683c96b37a pulsesink: s/ressource/resource/
https://bugzilla.gnome.org/show_bug.cgi?id=643087
2011-02-28 16:20:20 +05:30
David Henningsson
1e2c1467ae Pulsesink: Allow chunks up to bufsize instead of segsize
By allowing larger chunks to be sent, PulseAudio will have a
lower CPU usage. This is especially important on low-end machines,
where PulseAudio can crash if packets are coming in at a higher
rate than PulseAudio can process them.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-01-31 17:15:05 +01:00
Arun Raghavan
e18e25a324 pulsesink: Uncork stream while flushing the ringbuffer
After starting the ringbuffer, we wait for enough data to arrive before
uncorking the stream. This will cause the pipeline to stall if we get an
EOS (or otherwise need to flush the stream) before sufficient data
becomes available. This patch makes sure that the stream is uncorked
while flushing to avoid this problem.

Fixes issue with a webkit unit test testing reverse playback of
an MP4 H.264/AAC file.

https://bugzilla.gnome.org/show_bug.cgi?id=639740
2011-01-17 15:40:12 +00:00
Arun Raghavan
7280ea1f68 pulsesink: Make corking during pause synchronous
This makes the call to pa_stream_cork() during ringbuffer pause()
synchronous, which makes sure that the clock does not advance after we
take a snapshot for start_time.

https://bugzilla.gnome.org/show_bug.cgi?id=639240
2011-01-11 20:43:54 +00:00
Andy Wingo
82ee35372b add "client" property
* ext/pulse/pulsesrc.c (gst_pulsesrc_class_init, gst_pulsesrc_init)
  (gst_pulsesrc_set_property, gst_pulsesrc_get_property)
  (gst_pulsesrc_open): Add a "client" property, as in pulsesink.

Fixes #634914
2010-12-29 17:02:40 +01:00
Mark Nauwelaerts
53b9f87436 pulsesink: flush remaining buffered samples on EOS
... which can make a difference between all or nothing when dealing
with short streams and relatively large ringbuffer segment.
2010-12-16 15:16:54 +01:00
Jan Schmidt
bead93ab7b pulsemixer: Implement MIXER_FLAG_AUTO_NOTIFICATIONS
Add the mixer flag and send notifications when either the volume or muted
status changes.

    https://bugzilla.gnome.org/show_bug.cgi?id=618389
2010-12-11 16:08:40 +11:00
Wim Taymans
8ca094795a pulsesink: don't uncork in _start
Don't uncork in the _start method just yet but wait until we have written some
samples to pulseaudio. This avoid underruns on pulseaudio and less crackling
noises when starting.
2010-12-07 12:39:27 +01:00
Wim Taymans
7f48fb37e9 pulse: fix device_description in READY
Make the is_dead check more clear and add an option to check for the status of
the stream in addition to the context.
We don't need a stream to get the device_description string.

Fixes #630317
2010-09-22 19:02:35 +02:00
Stefan Kost
ae8d210fdb pulsesink: move the shared mainloop from class to static var
Just have one static var for the shared mainloop instead of one class variable
and copies in the instance.
2010-09-14 10:10:27 +03:00
Stefan Kost
f62dc6976b pulsesink: rework context sharing
We also need to share the main-loop threads as this owns the context. Thus have
a class wide main-loop thread. From this we create a context per client-name.
Instead of always looking up the context, we keep this with the instance. The
reverse mapping is only needed in pulse singal handlers. This saves a lot of
locking. Also one signal handler becomes simpler as ther eis only one mainloop
to notify.

Now valgind happy - no leaks, no bad reads/writes.

This reverts major parts of commit 69a397c32f.

Fixes #628996
2010-09-13 16:59:22 +03:00
Stefan Kost
6490c4eb3d pulsesink: remove unused code 2010-09-08 17:43:47 +03:00
Stefan Kost
9fd0adc7dc pulsesink: fixup last commit
We need to prevent the eventual leak better.
2010-09-08 14:36:48 +03:00
Stefan Kost
f6892b81ae pulsesink: code cleanups
Use g_slist_prepend as we don't care about the order. Check for list == NULL
instead of iterating the list to see if it is empty. Move ctx allocation down
to prevent leak in case of failure.
2010-09-08 14:19:34 +03:00
Wim Taymans
2148b2db0a pulsesink: simplify clock provide code
Don't leak the pulsesink element by having the clock keep a ref to the sink.
Create the clock only once in the constructor and use the baseaudiosink clock
cleanup code.
2010-09-07 19:03:33 +02:00
Stefan Kost
7fd77c07d5 pulsesink: move the context table init to _get_type phase
This seems to fix the invalid reads on context shutdown better, altough
I can't really explain.
2010-09-07 18:09:28 +03:00
Stefan Kost
f604e20499 pulse: allow setting stream properties
Add a "properties" property to the elements to allow setting extra stream
properties.

Fixes #537544
2010-09-07 14:20:21 +03:00
Stefan Kost
a313bc7524 pulsesink: don't free the context multiple times
Apparently the close function of the ring-buffer can be called multiple times.
2010-09-07 00:27:07 +03:00
Wim Taymans
95270dc2fb pulsesrc: use _get_caps_reffed() when we can
Use _get_caps_reffed()
Add some more debug when opening the server connection.
2010-09-06 10:23:07 +02:00
Stefan Kost
fc73dd210d pulsesink: add since docs for new property. 2010-09-06 09:57:58 +03:00
Stefan Kost
f83f7fafad pulsesrc: move the property-setter to the getter. 2010-09-06 09:53:00 +03:00
Sebastian Dröge
37ee281d13 pulsesink: Fail gracefully if no threaded PA mainloop can be created
Fixes bug #628020.
2010-09-04 14:52:09 +02:00