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.
When playing very short streams, the pulse plugin needs call
pa_stream_trigger() in snd_pcm_start() to make sure the stream is
actually started, in addition to uncorking the stream.
Some sanity checks in pcm_pulse.c with assert() causes the program to
abort unexpectedly when the pulseaudio daemon is dead. This is
suboptimal. Examples:
https://bugzilla.novell.com/show_bug.cgi?id=409532
Sjoerd Simons [Tue, 13 May 2008 12:16:06 +0000 (14:16 +0200)]
pulse - Change to hook load_if_running
Unfortunately some more testing revealed some issues with it,
specifically if pulse is running your complete config is replaced the bits in
the on_pulse_is_running directive. Which might not be what one actually wants :)
I couldn't find a proper solution for this. So i've changed the code to
optionally load config files. Just like the load hook does. Actually i just
optionally call the snd_config_hook_load function, but that's not actually in
the alsa API....
Also it now decides pulse is running as soon as the authorizing step begins
(just after the actually connection is setup), which should save some
round-trips and overhead.
The attached patch extends the alsa pulse plugin set with a alsa
configuration hook. Allowing one to specify some configuration parameters
that only come into effect when pulseaudio is running.
For example a configution file like:
@hooks [ {
func on_pulse_is_running
pcm.!default { type pulse }
ctl.!default { type pulse }
}
]
will redirect the default alsa pcm and ctl to pulse iff pulse is running.
(Assuming you defined the hook function correctly ofcourse)
This is usefull for distributions that don't want to force their users to
switch completely to pulseaudio, but have things a bit more dynamic :)
The solutions isn't optimal though. It will mean that every program loading
accessing alsa will try to make an (extra) connection to pulse to decide what
to do. But i think it's the best we can do for now (or at least that i can do
with my minimal knowledge of alsa).
A nicer solution would be a way to always specify the pulse plugin as default
and have a sort of fallback for when that fails.
The Maemo DSP plugin checks for D-Bus in configure.in and then makes a bold assumption that this means it should use a proprietary resource manager available only on a specific proprietary platform.
Attaching a patch to add --enable-maemo-resource-manager configure flag that enables the resource manager if set and if D-Bus is present.
Ignore hint sections defined by hand.
Those are heplful to get listed in various places, such as aplay -L
ALSA bug#3834:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3834