Commit graph

1243 commits

Author SHA1 Message Date
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
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
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
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
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
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
Lennart Poettering
9472d7aeec alsa-mixer: make a few strings translatable
Original patch contributed by 'kelemeng'

http://pulseaudio.org/ticket/843
2010-11-25 04:03:58 +01:00
Stephen Moehle
803659883d upnp: Implement the MediaServer2 D-Bus interface
This allows PulseAudio to work with versions of Rygel 0.7.1 and higher
which only support MediaServer2:
 http://live.gnome.org/Rygel/MediaServer2Spec
2010-11-17 23:44:57 +00:00
Colin Guthrie
70a060db92 combine: Only check if the sink is h/w etc. in automatic mode 2010-11-17 23:44:57 +00:00
Antti-Ville Jansson
33ea7b7816 combine: Handle reappearing slave sinks in non-automatic mode.
Earlier, if slave sinks were unlinked in non-automatic mode, their
re-appearance was disregarded. Now they are added back to the list of outputs.

Signed-off-by: Antti-Ville Jansson <antti-ville.jansson@digia.com>
Reviewed-by: Tanu Kaskinen <tanu.kaskinen@digia.com>
2010-11-17 22:02:46 +00:00
Pierre-Louis Bossart
34fd605677 alsa: remove redundant call to snd_pcm_nonblock()
The PCM handle is already opened with the SND_PCM_NONBLOCK flag.
This additional call is useless.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
2010-11-17 22:02:29 +00:00
Daniel Mack
8a30d4c06e alsa-mixer: add profile for Native Instruments Korecontroller 2010-10-31 20:32:39 +00:00
Colin Guthrie
a378c02ebb augment-properties: Fix debug messages and statement bracketing. 2010-10-06 09:16:16 +01:00
Colin Guthrie
a21b8328aa device-manager: Ensure that sinks/sources populate the device manager lists in order of their priority.
Currently the order of the sinks is simply that of their position in the idxset which is certainly
not what the user would want.
2010-09-29 22:10:29 +01:00
Colin Guthrie
858abe6cb9 augment-properties: Search for .desktop files in subfolders too. 2010-09-29 22:10:23 +01:00
Colin Guthrie
a7a6f4427d stream-restore: Clear the save_sink/save_source flags on apply_entry.
If the user specifically removes the device element from the stream
restore rule, we have to clear the save_sink/save_source flag of the
stream. This means that other stream routing systems
(e.g. module-device-manager) can take over routing for this
stream. In order to facilitate the reapplication of other routing
rules, we fire a stream change event. Arguably the stream itself
has not changed, but the rules governing its routing have, so
I feel this is justified.
2010-09-29 22:09:58 +01:00
Colin Guthrie
165cb87c38 x11: Use the default screen for X11 properties.
This commit restores the functionality originally included in 65e807
by Leszek Koltunski.
2010-09-18 11:38:44 +01:00
Colin Guthrie
eef247b57e alsa: Only set the 'first' flag to false when we actually call snd_pcm_start()
Previously, if work_done was false, we could conceivably not call snd_pcm_start().
2010-09-14 19:45:09 +01:00
Daniel Mack
28f4aebfbf alsa-mixer: add profile for Traktor Kontrol S4
This new audio interface from Native Instruments has 2 stereo channels
for both input and output direction. This patch adds mappings for them.
2010-09-14 08:49:53 +01:00
Wim Taymans
1ff360c7b1 alsa: make defines for smoother configuration
Make new defines for the smoother window size and adjust time constants instead
of reusing some unrelated constant.

Increase the smoother window size even more because the bigger it is, the
better. Since we have a 200ms max update interval and the max smoother history
is 64 entries, 10seconds is a good default.

Decrease the smoother adjust time to 1 second. The previous value of 4 seconds
was too much to adapt quickly after a resume.
2010-09-14 08:47:11 +01:00
Wim Taymans
1c29f5582d alsa: work around slightly broken _delay implementations
Use snd_pcm_avail_delay() in pa_alsa_safe_delay() so that we can check the delay
value against the avail value and patch it up when it looks invalid. Only do
this for capture.
2010-09-14 08:46:41 +01:00
Wim Taymans
1503b8cf9b alsa-source: refactor smoother and device start
Move the code to start the capture and the smoother closer together to improve
smoother accuracy.
Rework things to look more like the alsa sink where the device is started in
only one place.
2010-09-14 08:45:29 +01:00
Colin Guthrie
a65825fa45 alsa: Set the rewind safeguard proportionally to sample spec
Currently when rewinding alsa, a fixed value of 256 bytes is used,
which represents 1.33ms @ 48kHz (2ch, 16bit). This is typically fine
and due to DMA constraints we would not want to rewind less than this.

However with more demanding sample specs, (e.g. 8ch 192kHz 32bit)
256 bytes is likely not sufficient, so calculate what 1.33ms would
be and use which ever value is bigger.

Discussed with David Henningsson and Pierre-Louis Bossart here:
 http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/7286
2010-09-04 12:49:26 +01:00
Tanu Kaskinen
8748ebdad3 alsa-sink: Get rid of a compiler warning regarding rewind_safeguard type.
GCC gave a warning, because the pointer given to pa_modargs_get_value_u32() had
type size_t instead of uint32_t.
2010-09-04 12:49:16 +01:00