Commit graph

3262 commits

Author SHA1 Message Date
Arun Raghavan
f93b5e1869 echo-cancel: Fix source may_move_to function
This is required to make sure that the source output between
module-echo-cancel and ALSA can't get plugged to the virtual source or
monitor of the virtual sink that we expose. This could be triggered by
changing the profile of the underlying ALSA device.
2011-03-28 14:41:00 +05:30
Arun Raghavan
d866adee0e echo-cancel: Use S16NE for adrian module
This forces us to get native-endian samples in the adrian module so that
we can rely on the existing endianness conversion mechanisms instead of
doing it in the module.
2011-03-28 14:41:00 +05:30
Arun Raghavan
1212a6fd78 echo-cancel: Ensure correct handling of endianness
The adrian module was using home-brewed endianness conversion instead of
the appropriate mactos, and speex assumed a little-endian host. This
fixes both of these.
2011-03-28 14:41:00 +05:30
Arun Raghavan
d8fab8429d echo-cancel: Fix out-of-tree build 2011-03-28 14:41:00 +05:30
Rico Tzschichholz
d39043c30c echo-cancel: Fix make distcheck
Add missing files to module_echo_cancel_la_SOURCES
Add Adrian license file to EXTRA_DIST
2011-03-28 14:41:00 +05:30
Wim Taymans
e9364476e4 echo-cancel: pause timer when echo canceling is off
While the sink or source is in the suspended state, disable the timer
callback because we are not doing any echo canceling then.
2011-03-28 14:41:00 +05:30
Wim Taymans
56a46842f8 echo-cancel: improve accuracy
Make the echo canceler drift up to 1ms now that things are more accurate.
Add 10 samples of headroom to allow for timing inaccuracies.
2011-03-28 14:41:00 +05:30
Wim Taymans
9f79c0ebb1 echo-cancel: rework alignment code
Rework the code to align capture and playback samples so that we can keep more
accurate timings.
2011-03-28 14:41:00 +05:30
Arun Raghavan
2923c5eb68 echo-cancel: Mark immutable parameters as const in vfunc
Marks the recording and playback streams as const in the
pa_echo_canceller->run method for clarity.
2011-03-28 14:41:00 +05:30
Arun Raghavan
b6b8a7b7a7 echo-cancel: Make blocksize a module-wide parameter
Since all algorithms will need to specify a block size (the amount of
data to be processed together), we make this a common parameter and have
the implementation set it at initialisation time.
2011-03-28 14:41:00 +05:30
Arun Raghavan
4a9fa8cc7f echo-cancel: Allow selection of AEC method using modargs
This adds an "aec_method" module argument to allow us to select the AEC
implementation to use.
2011-03-28 14:41:00 +05:30
Arun Raghavan
47e4dd1ec4 echo-cancel: Add alternative echo-cancellation implementation
This adds Andre Adrian's AEC implementation from his intercom project
(http://andreadrian.de/intercom/) as an alternative to the speex echo
cancellation routines. Since the implementation was in C++ and not in
the form of a library, I have converted the code to C and made a local
copy of the implementation.

The implementation actually works on floating point data, so we can
tweak it to work with both integer and floating point samples (currently
we just use S16LE).
2011-03-28 14:41:00 +05:30
Arun Raghavan
c975dfa5a5 echo-cancel: Let AEC module determine source/sink spec
Since the source and sink specification will need to be determined by
the AEC algorithm (can it handle multi-channel audio, does it work with
a fixed sample rate, etc.), we negotiate these using inout parameters at
initialisation time.

There is opportunity to make the sink-handling more elegant. Since the
sink data isn't used for playback (just processing), we could pass
through the data as-is and resample to the required spec before using in
the cancellation algorithm. This isn't too important immediately, but
would be nice to have.
2011-03-28 14:41:00 +05:30
Arun Raghavan
668f4e49b6 echo-cancel: Pass arguments to the specific canceller module
This allows us to tweak module parameters for whichever AEC module is
chosen.
2011-03-28 14:40:59 +05:30
Arun Raghavan
57c5983937 echo-cancel: Split out speex code from the core module
This splits out the echo-cancelling core from the PA-specific bits to
allow us to plug in other echo-cancellation engines.
2011-03-28 14:40:59 +05:30
Arun Raghavan
6d8a90709e echo-cancel: Move the module into it's own directory
This will make splitting out the canceller parts cleaner.
2011-03-28 14:40:59 +05:30
Wim Taymans
b30bf121d2 echo-cancel: keep frame_size a power of 2
The speex echo canceler prefers a power of 2 for the frame size. Round down the
ideal frame_size to the nearest power of two. This makes sure we don't create
more than the requested frame_size_ms latency while still providing a power of 2
to the speex echo canceller.
2011-03-28 14:40:59 +05:30
Wim Taymans
1c2669452b echo-cancel: improve debug 2011-03-28 14:40:59 +05:30
Wim Taymans
de6cdf9487 echo-cancel: tweak the resync code a little
Try to keep the drift between source and sink within 4ms now that we have more
accurate timings.
Don't force a resync on latency changes but let the drift code handle it.
2011-03-28 14:40:59 +05:30
Wim Taymans
7b972f5a45 echo-cancel: use the phone media role
Tag the source and sink with the phone media roles so that they automatially
connect to phone streams such as Empathy when using the intended-rols module.
2011-03-28 14:40:59 +05:30
Wim Taymans
9fa71e75e5 echo-cancel: take into account snapshot delay
Take into account the delay between taking the snapshot from the source and the
sink. Improves the quality of the timings.
2011-03-28 14:40:59 +05:30
Wim Taymans
1a8cf00ba0 make echo-cancel module that exposes a new sink and source
Make a new echo-cancel module that exposes a new sink and source. All data sent
to the sink is matched against the data captured from the source and
echo-canceled using the speex echo canceler.
2011-03-28 14:40:59 +05:30
Lennart Poettering
c524b4c5b5 memblockq: implement new call pa_memblockq_peek_fixed_size() 2011-03-28 14:40:59 +05:30
Colin Guthrie
b872254762 volume: Add a PA_VOLUME_UI_MAX define for the recommended max volume to show in UIs
This value is not a technical upper limit, it's just a 'sensible'
value that is not crazy high, but also allows software amplification
above 0dB (aka 100%) for very quiet audio sources.

We recommend that a comprehensive volume control UI should allow
users to set volumes up to this limit, although of course should
deal gracefully if the user has set the volume even higher than this
without resulting in a feedback loop that effectively limits the
upper volume.

The value chosen is +11dB. This was selected somewhat subjectively
and is very similar to the current 150% that gnome-volume-control
uses (which is ~+10.57dB).

On the plus side, we now recommend that everyone allows
'Volumes up to 11' which is pretty awesome.
http://en.wikipedia.org/wiki/Up_to_eleven

https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-April/006945.html
https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-April/006950.html
2011-03-03 13:29:08 +00:00
Colin Guthrie
a8cd9d2880 conf: Make system.pa use udev-detect and not hal-detect.
Also fix a left over reference to HAL in default.pa
2011-03-03 09:37:29 +00:00
Maarten Bosmans
2ee4ec507c module-rtp-recv: Remove smoother from write index
It isn't necessary anymore with the new algorithm.  The slow adjust of the
smoother was even detrimental to the accuracy of the rate estimate.
2011-02-25 10:34:50 +00:00
Maarten Bosmans
2bfc0322c9 module-rtp-recv: Average the estimated real sample rate 2011-02-25 10:34:46 +00:00
Maarten Bosmans
46200391f3 module-rtp-recv: Use new algorithm for adjusting sample rate 2011-02-25 10:34:41 +00:00
Maarten Bosmans
90c5520e03 Limit rate adjustments to small, inaudible jumps
The same logic is applied to the sample rate adjustments in module-rtp-recv,
module-loopback and module-combine:
 - Each time an adjustment is made, the new rate can differ at most 2‰ from the
   old rate.  Such a step is equal to 3.5 cents (a cent is 1/100th of a
   semitone) and as 5 cents is generally considered the smallest observable
   difference in pitch, this results in inaudible adjustments.
 - The sample rate of the stream can only differ from the rate of the
   corresponding sink by 25%.  As these adjustments are meant to account for
   very small clock drifts, any large deviation from the base rate suggests
   something is seriously wrong.
 - If the calculated rate is within 20Hz of the base rate, set it to the base
   rate.  This saves CPU because no resampling is necessary.
2011-02-25 10:34:37 +00:00
Maarten Bosmans
09770e5779 module-loopback: Add adjust_time to valid args 2011-02-25 10:34:33 +00:00
Arun Raghavan
67d188894c client: Don't update smoother while corked
This prevents the smoother attached to the stream clock from being
updated while the stream is corked, which in turn ensures that once
corking is completed, pa_stream_get_time() always returns the same value
until the stream is uncorked - i.e., the clock does not advance when the
client believes that it will not.

The actual call to pa_smoother_put() happens on things like stream
suspend/unsuspend, which trigger timing updates. This changes the
smoother coefficients, which means that a call to pa_smoother_get() for
the same value of 'x' can return different values before and after a
timing update.
2011-02-01 10:38:27 +00:00
David Henningsson
6b280e97e3 Fighting rewinds: Reduce calls to handle_seek
If many small blocks are in queue, handle_seek is being called
for every one of them, sometimes causing a rewind. Delay the
call until all blocks are handled, then call handle_seek only
once.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-01-31 11:38:55 +00:00
David Henningsson
3aeb047282 Fighting rewinds: Seek and write data in the same message
Allow a message in the queue to perform both a seek and a post data.
For clients that do not use PA_SEEK_RELATIVE (e g gstreamer), this
cuts the message count - and sometimes even the rewinds - in half.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-01-31 11:38:44 +00:00
Scott Reeves
1e1b299784 Core: Fix incorrect check of return value 2011-01-23 14:19:39 +00:00
Colin Guthrie
408072519e tunnel: Fix automatic names when source/sink_name argument is missing.
Spotted by palmerdabbelt via #894
2011-01-23 13:12:15 +00:00
Lennart Poettering
ec5a785712 ratelimit: fix log levels of log suppression messages
When logging a suppression message do so on the same log level as the
suppressed messages.
2011-01-22 01:08:36 +01:00
Colin Guthrie
862bbee309 console-kit: Console Kit support is dependent on DBUS and is thus optional.
Therefore, we must reflect this in the default.pa. Several users
have reported an error with consolekit when starting a self-built PA
due to the default config not working properly. This works around the
issue but we should include a warning on configure about the lack of
DBUS and udev support as this is a common mistake.
2011-01-11 11:27:30 +00:00
Michal Schmidt
7cb1401eae padsp: wrap __open_2 and __open64_2
These functions are used in OSS programs where the "flags" parameter for
open() is not a build-time constant and the build has _FORTIFY_SOURCE
enabled.
2011-01-10 20:49:56 +00:00
Chen Rui
6f870f501d fix bug about get source-output status 2010-12-20 11:30:49 +00:00
Zhang Wanming
4269b05b97 Fix typos 2010-12-20 11:08:31 +00:00
Vincent Becker
84c8b23c7f Fix return value of pa_sndfile_format_from_string
This prevented to use pacat --file-format option correctly
2010-12-18 11:25:09 +00:00
Yang Xichuan
d963b868de core: Fix variable "has_whined" value bug
In the file src/pulsecore/random.c

I found that the log information "Failed to get proper entropy. Falling
back to seeding with current time." would never be printed.

This change corrects the issue.
2010-12-18 11:21:02 +00:00
Maarten Lankhorst
3e6af07496 module-loopback: Prevent an infinite loop when rate adjusting is disabled 2010-12-12 20:32:28 +00:00
David Henningsson
205cad6eed jack: Add module-jackdbus-detect 2010-12-05 16:01:46 +00:00
Colin Guthrie
675cc0ae0b build-sys: Replace dummy Makefiles with proper Makefile.am's
This is needed to better support out of tree builds (including
distcheck) and to ensure the necessary folders are created in the
build tree on configure and also works around an intl-tools bug
(https://bugs.launchpad.net/intltool/+bug/605826)

The Makefile.am's used are minimal (and in some cases completely
blank). At present they do not include anything interesting
with the majority of the real work still done by the monolitic
src/Makefile.am

It may make sense to start splitting out src/Makefile.am into
smaller chunks but this commit makes the minimum changes to address
the issues that result from using make distcheck and other out of
tree builds.

Note: This 'breaks' the ability to type make in e.g. the src/modules
folder and have all of PA rebuilt accordingly (this is because the
static Makefiles previously present just did a "make -C ..") which
was purportedly for use in emacs. But I'm sure there will be a better
and more robust way to configure emacs to do your builds properly if
this behaviour is still desirable.
2010-12-04 13:59:48 +00:00
Arun Raghavan
bd769fa98a rescue-streams: Fix segfault in some conditions
There is a call to this function where 'skip' variable is NULL. Looks
like this code doesn't get hit very often, probably because a suitable
default sink can be found to move the stream to. However, if we can't
move to the default sink and skip is NULL, there will be a segfault.
2010-12-02 14:45:17 +00:00
Arun Raghavan
f6574c8c22 volume: Add explicit checks for ARMv6 instructions
This ensures that the build does not fail if the ssat and pkhbt
instructions are not available (armv5te and below).

Fixes: http://www.pulseaudio.org/ticket/790
2010-11-28 16:58:38 +00:00
Daniel T Chen
dad4b4e742 Handle 'Internal Mic 1' as an 'Input Source'
BugLink: https://launchpad.net/bugs/680810

Some laptops have 'Internal Mic 1' exposed as an 'Input Source', e.g., Dell
XPSM 1530, so handle these, too.

Signed-off-by: Daniel T Chen <crimsun@ubuntu.com>
2010-11-25 15:14:03 +00:00
David Henningsson
167a9a4ae6 Add "Rear Mic" to alsa mixer paths.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2010-11-25 15:13:34 +00:00
Lennart Poettering
b53f06a942 alsa-source: fix enum types 2010-11-25 04:34:04 +01:00