Andrew Eikum [Mon, 20 Aug 2012 09:28:14 +0000 (11:28 +0200)]
pulse: Support 24-bit formats
These formats were introduced in PulseAudio 0.9.15. There aren't any
new formats supported since then, so this also brings the PulseAudio
plugin in sync with current PulseAudio.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fons Adriaensen [Mon, 9 Jan 2012 17:18:10 +0000 (18:18 +0100)]
jack: Fix revents for playback
The following patch will make snd_pcm_poll_descriptors_revents()
return the correct value when used on a jack plugin device.
The current version returns POLLIN regardless of capture or
playback.
Takashi Iwai [Tue, 23 Aug 2011 15:02:17 +0000 (17:02 +0200)]
pulse - only underrun if no more data has been written
Original patch from David Henningsson <david.henningsson@canonical.com>
If more data has already been written after the underrun, the underrun
will automatically end and therefore we should not report it or
restart the stream.
[ This patch adds a more check of underrun with a new PA function so
that the underrun handles works more reliably. As the feature is
supported only in a recent version of PA, the underrun handling is
enabled as default now for the new PA, while it's still disabled for
older PA. -- tiwai ]
Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
applications hang after some seconds when using the jack plugin.
Kevin Ross <kevin@familyross.net> writes:
The cause: The plugin creates a pipe, so that the fd's could be
polled to indicate completion of a transfer. However, the call to
write() blocks when playing audio, as nothing actually reads from the
pipe, and it fills up until it blocks.
Making the socket non-blocking fixes the problem, and testing with
playback and capture both work properly for me now.
[Adrian: I've also tested Kevin's patch and confirm it works.]
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
a52 - Fix a52 codec with recent libavcodec updates
The recent libavcodec is changed to accept only float input, but
the old ac3 encoder is still somehow working with a different name.
This patch makes it working again.
Added a config option "handle_underrun" to specify whether pulse plugin
handles the underrun reported from PA. The default value is now set to
false, i.e. it will ignore underruns in PA (for good reasons below).
You can take back to the old behavior by setting handle_underrun true.
The original idea was brought by David Henningsson <diwic@ubuntu.com>,
while this patch is simplified and makes the behavior configurable.
The reasons for avoiding underruns (cited from David's original patch):
Reporting underruns to ALSA seems to do more bad than good, for these reasons:
* If pulseaudio gets an underrun, the normal way to end that underrun is to
feed it with more buffers. This is different from the ALSA way of dealing
with underruns, which requires hardware buffer pointers to be reset.
* In addition, underrun signals are delivered asynchronously from pulseaudio.
This means that there might be more buffers on the way to pulseaudio when
the underrun is reported, making the underrun obsolete. Unfortunately,
there is currently no known way to determine whether this is the case or
not.
This patch improves recovering from underruns, and prevents hangs inside
snd_pcm_write* and snd_pcm_read* due to snd_pcm_avail* returning too
low values. It especially helps low latency situations.
Signed-off-by: David Henningsson <diwic@ubuntu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Anssi Hannula [Fri, 27 Nov 2009 15:15:45 +0000 (17:15 +0200)]
a52 - fix 5.1 channel order with recent libavcodec
As of SVN r18540 libavcodec expects 5.1 channel audio with SMPTE channel
order. Fix ALSA a52 plugin to use that order when built against such a
libavcodec. Minor version of libavcodec was raised on the same day (Apr
17th 2009), so use that for the check.
Unify (and simplify) the paths that check for the validity of a
stream/context: always call into check_stream()/pulse_check_connection()
when applicable instead of rolling our own checks each time. Also check
for validity of mainloop before locking it.
snd_pulse_t::state was mostly shadowing the state of
pa_context_get_state(snd_pulse_t::context), so get rid of it and use the
state of the context directly.
pulse: move a couple of PCM related functions from pulse.c to pcm_pulse.c
A number of functions in pulse.c are only relevant for the PCM handling,
so let's move them to pcm_pulse.c. This allows us to simplify their
argument lists a bit.
pulse: call pa_threaded_mainloop_wait() to handle spurious wakeups
pa_threaded_mainloop_wait() can wake up for no reason, according to the
specs of the underlying POSIX ptrhead_cond_wait() docs, so we need to
call it in a loop here which should be cleaner anyway.
Instead of hitting an assert when any of the plugin functions is called
in an invalid context we should return a clean error to make sure
programs are not unnecessarily aborted.
This should fix issues such as http://pulseaudio.org/ticket/595
By doing this we move them from the .data section to .rodata setion,
or from .data.rel to .data.rel.ro.
The .rodata section is mapped directly from the on-disk file, which is
always a save, while .data.rel.ro is mapped directly when using
prelink, which is a save in a lot of cases.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Pass libraries on LIBADD rather than LDFLAGS, don't link to libdl
since it's unneeded, no need to pass -shared since libtool's -module
takes care of that, the same goes for -fPIC -DPIC (which might not
even be the right option).
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Add the attributes.m4 macro file from xine/lscube.
This is a shared macro file that is currently maintained in both xine
and lscube repositories and contains a series of utility macros to
check compiler and linker features.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Allow opt-out from jack, pulseaudio and avcodec dependencies.
Without this patch the jack, pulseaudio and avcodec discovery was
"automagic", without a way for the user to disable the relative
plugins if the dependencies are installed but the plugin is unwanted.
This patch does not change the default behaviour but allows to opt-out
from the plugins by passing the relative --without option at
./configure time.
Signed-off-by: Diego 'Flameeyes' Pettenò <flameeyes@gmail.com>
Takashi Iwai [Wed, 15 Oct 2008 10:18:23 +0000 (12:18 +0200)]
pulse - Fix capture problem
In pulse_start(), pa_stream_trigger() may return NULL for the capture
stream, and this caused -EIO error.
Allow now pa_stream_trigger() returning NULL.
pulse - Start PA event loop after we have created the context
We shouldn't be passing the main loop object to the pa_context while
that loop is running and not locked. Push the main loop startup after we
created the main loop.
Remove our own poll handler implementation entirely
Neither pcm_pulse.c nor ctl_pulse.c is using our poll handler implementation
anymore, so let's get rid of the common parts previously used by them, too
Use PA_STREAM_EARLY_REQUESTS if PA knows it. PA >= 0.9.12 learned this flag
which will make the buffering more similar to traditional fragment/period-based
scheduling. Instead of delaying buffer fillup until the latest moment possible
this will cause fillups much earlier.
This is useful for compatibility for broken ALSA clients that don't care about
'readability' of the ALSA fd but instead schedule audio via usleep() or a
similar call. (One exampler being mplayer)
Make sure the pa_context is disconnected when we unref it. This is also done
implicitly when the last reference to the pa_context is dropped, but that might
be later then expected in case someone else took a reference on our object. To
make sure that the pa_context will than not make any call into our code,
disconnect it explicitly.
Since quite a while (2 years or so) PulsAudio doesn't require SIGPIPE anymore
to be set to SIG_IGN. Since resetting this was incredibly ugly in the first
place it is now time to get rid of this.
The PulseAudio plugin was horrible mix-up of different indenting styles even in
the same files. Indenting by 4, by 2, by 8 characters, sometimes with tabs,
sometimes with spaces. To fix this chaos I ran all files through "indent -kr
-i8". Hopefully future patches will follow kernel style indenting too.
Takashi Iwai [Tue, 26 Aug 2008 15:06:43 +0000 (17:06 +0200)]
Fix build with recent ffmpeg
Add a check of pkgconfig libavcodec in configure script.
Since the header file was moved to <libavcodec/*>, its location has
to be checked in configure, too.