Re: [pulseaudio-discuss] [PATCH 0/4] Add support for libsoxr resampler
On Friday 14 November 2014 08:26:18 David Henningsson wrote: On 2014-11-13 23:49, Andrey Semashev wrote: I do not have an explanation for such diverse range of the delay value, and its dependency on the frame size. It doesn't look like the filter is learning from the input in some way since the delay doesn't depend on the content. Perhaps there is some extensive buffering in the implementation. Well, the delay must be constant given the parameters. If the delay was varying during playback, that would probably cause very interesting sound effects, such as music being slightly out of tempo or so... I've been using soxr-vhq with PA 4.0 on my working machine for about a month now, and never heard any sound artefacts. What does vary during playback, however, is how big chunks we pass into the resampler in every go. Which begs the question if it is the first chunk that determines the delay, or...? So PA uses variable frame size? I can try to modify the test for that. Are there any reasonable limits of the frame size? For now the bottom line is that the exact delay of the resampler is difficult to predict, although it usually does not exceed 20 ms, except some rare cases and -vhq. When delay is critical it is better to use another resampler, like speex-5, for instance, which consistently stays below 1 ms across the board. But I think, such cases are quite specialized, and soxr is still very well applicable in general use. Well, what is quite specialized and general use? If you use your computer primarily for gaming and VOIP, then that's what you consider general use, and perhaps listening to music so carefully that you hear the difference between different resamplers is what you consider quite specialized... So if it was up to me, I'd say let's keep speex-float-1 as the default, as it seems to give the best balance between quality, CPU power, and low latency. With my upstream hat on, I don't mind adding soxr as an option, and with my distro hat on, I'm always worried about adding new dependencies... I'm not changing the default with these patches, soxr is added as an option. If not the delay, it would be a very good candidate for being the default, though. As a side note, I think speex-float-1 is a rather poor default as well because of its quality. Anyone who cares about the sound he gets will likely change it to something like speex-float-3 or 5 anyway. IMHO. ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH 0/4] Add support for libsoxr resampler
14.11.2014 13:37, Andrey Semashev wrote: As a side note, I think speex-float-1 is a rather poor default as well because of its quality. Anyone who cares about the sound he gets will likely change it to something like speex-float-3 or 5 anyway. IMHO. Initially I also thought so and argued for changing the default. But then I applied a psychoacoustical model and found that on real music that you can buy or download, due to masking, the difference between speex-float-1 and ideal resampler is below the threshold where a human can notice. On artificial testcases, yes, speex-float-1 does produce audible distortions, but who cares? Nobody listens to sine waves. The prior research is available at the following locations: http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021362.html (initial attempt to measure distortions and judge their audibility by means of a psychoacoustical model, on sine waves) http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-September/021811.html (attempt to take non-ideal listening conditions into account, but still on sine waves) http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-October/021911.html (the latest results, on real music files - going away from pure tones dramatically changes the picture) In order to defend your speex-float-1 is too bad statement, you need to refute at least one of my bases: 1. The psychoacoustical model described in http://www.mp3-tech.org/programmer/docs/6_Heusdens.pdf 2. The method of collecting a resampler response to sine waves. 3. The implicit assumption that, when a signal with non-trivial spectrum is resampled, the power of distortions at each target frequency adds up linearly. In other words, if two source frequencies contribute to unwanted distortions at one target frequency, these contributions are uncorrelated. -- Alexander E. Patrakov ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
On 2014-11-14 07:07, Arun Raghavan wrote: Hello, As promised, master is now frozen. Please do not push anything other than essential fixes.I'd like to have some stability testing of HSP before rolling 6.0 RC1. I'd like to have my HSP compilation patches in before 6.0 RC1. Can I push them? Any help here is appreciated. Ok, with some trouble [1] I installed bluez5 in Ubuntu 15.04 and ran PulseAudio git master on top of that, with the native headset backend. Result: Headset card shows up. Switching between A2DP and HSP seems to be working. The hsp profile is called headset_head_unit, which is a change from bluez4, but it's nothing that seems to cause problems for me. HSP playback and recording seems to work. Volume control (playback) and gain control (recording) does not work, i e, changing volume and/or gain has no effect on actual volume/gain. -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic [1] For the interested, I grabbed Debian's bluez5 sources from jessie, recompiled them and installed the resulting bluez and libbluetooth packages. That caused the bluez postinst script to hang. I worked around this by adding the --noscripts option to dh_installinit in debian/rules. After installation/reboot, I used bluetoothctl for pairing and connecting to the headset. ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
On 14 Nov 2014 15:00, David Henningsson david.hennings...@canonical.com wrote: On 2014-11-14 07:07, Arun Raghavan wrote: Hello, As promised, master is now frozen. Please do not push anything other than essential fixes.I'd like to have some stability testing of HSP before rolling 6.0 RC1. I'd like to have my HSP compilation patches in before 6.0 RC1. Can I push them? I thought this was done. Please go ahead. Any help here is appreciated. Ok, with some trouble [1] I installed bluez5 in Ubuntu 15.04 and ran PulseAudio git master on top of that, with the native headset backend. Result: Headset card shows up. Switching between A2DP and HSP seems to be working. The hsp profile is called headset_head_unit, which is a change from bluez4, but it's nothing that seems to cause problems for me. HSP playback and recording seems to work. Volume control (playback) and gain control (recording) does not work, i e, changing volume and/or gain has no effect on actual volume/gain. Thanks for trying this. At least the volume bit is the same for us both. Will need to investigate that. Wim/Luiz, any ideas? If it was otherwise stable for you, that if good news indeed. Cheers, Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
Can you check in the log if the volume AT commands are sent to the headset? What I can think of is maybe that the command is not formatted properly (like missing a \n\r somewhere, I've seen some headset be picky about that). Wim On 14 November 2014 10:39, Arun Raghavan a...@accosted.net wrote: On 14 Nov 2014 15:00, David Henningsson david.hennings...@canonical.com wrote: On 2014-11-14 07:07, Arun Raghavan wrote: Hello, As promised, master is now frozen. Please do not push anything other than essential fixes.I'd like to have some stability testing of HSP before rolling 6.0 RC1. I'd like to have my HSP compilation patches in before 6.0 RC1. Can I push them? I thought this was done. Please go ahead. Any help here is appreciated. Ok, with some trouble [1] I installed bluez5 in Ubuntu 15.04 and ran PulseAudio git master on top of that, with the native headset backend. Result: Headset card shows up. Switching between A2DP and HSP seems to be working. The hsp profile is called headset_head_unit, which is a change from bluez4, but it's nothing that seems to cause problems for me. HSP playback and recording seems to work. Volume control (playback) and gain control (recording) does not work, i e, changing volume and/or gain has no effect on actual volume/gain. Thanks for trying this. At least the volume bit is the same for us both. Will need to investigate that. Wim/Luiz, any ideas? If it was otherwise stable for you, that if good news indeed. Cheers, Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
On 14 Nov 2014 15:13, Wim Taymans wim.taym...@gmail.com wrote: Can you check in the log if the volume AT commands are sent to the headset? What I can think of is maybe that the command is not formatted properly (like missing a \n\r somewhere, I've seen some headset be picky about that). I'd checked that the AT commands are going out fine in hcidump. Tested with 2 headsets here, both did not work. I did add a couple of fixes on top of your volume patches, btw. --Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
On 14 Nov 2014 15:31, Wim Taymans wim.taym...@gmail.com wrote: Can you compare with a hcidump of working volume? It never actually worked for me. If you have one that works, I can compare with what I get here ( well probably take a day or two). -- Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
On Friday 14 November 2014 07:07:40 Arun Raghavan wrote: Hello, As promised, master is now frozen. Please do not push anything other than essential fixes. I'd like to have some stability testing of HSP before rolling 6.0 RC1. Any help here is appreciated. Regards, Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discu ss Hello, I would like to discuss about autoswitching between hsp and a2dp bluetooth profiles patches (v3): http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/21479/focus=21899 I still think that patch could be in new version, so users of VOIP applications will not have to manually switch between profiles when they want to start voice call. -- Pali Rohár pali.ro...@gmail.com signature.asc Description: This is a digitally signed message part. ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH v2] alsa: Check return value of snd_pcm_mmap_commit()
On 2014-11-13 10:48, Peter Meerwald wrote: From: Peter Meerwald p.meerw...@bct-electronic.com snd_pcm_mmap_commit() actually transfers the memory area prepared by snd_pcm_mmap_begin(), it returns the 'count of transferred frames' which should be equal to the number of frames returned by snd_pcm_mmap_begin() however, this identify is not checked and the number of frames prepared are accounted for, not the number of frames commited -- this is wrong; the ALSA example codes bothers to check snd_pcm_mmap_commit()'s returned number of frames this patch just outputs a warning when sframes != frames -- let's see if it ever happens It also seems to do refactoring? v2: (thanks David Henningson) * just log, no functional change as in v1 * fix typos, fix subject Signed-off-by: Peter Meerwald pme...@pmeerw.net --- src/modules/alsa/alsa-sink.c | 11 +-- src/modules/alsa/alsa-source.c | 17 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index e256bbd..35f013c 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -639,8 +639,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bo p = (uint8_t*) areas[0].addr + (offset * u-frame_size); -written = frames * u-frame_size; -chunk.memblock = pa_memblock_new_fixed(u-core-mempool, p, written, true); +chunk.memblock = pa_memblock_new_fixed(u-core-mempool, p, frames * u-frame_size, true); chunk.length = pa_memblock_get_length(chunk.memblock); chunk.index = 0; @@ -660,6 +659,14 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bo work_done = true; +if (PA_UNLIKELY((snd_pcm_uframes_t) sframes != frames)) { +PA_ONCE_BEGIN { +pa_log_warn(ALSA mmap write was set up for %lu frames, but unexpectedly commited %lu frames.\n, +(unsigned long) frames, (unsigned long) sframes); +} PA_ONCE_END; +} + +written = frames * u-frame_size; u-write_count += written; u-since_start += written; diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 111c517..97d0d22 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -562,6 +562,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, boo const snd_pcm_channel_area_t *areas; snd_pcm_uframes_t offset, frames; snd_pcm_sframes_t sframes; +size_t got; frames = (snd_pcm_uframes_t) (n_bytes / u-frame_size); /* pa_log_debug(%lu frames to read, (unsigned long) frames); */ @@ -613,16 +614,24 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, boo work_done = true; -u-read_count += frames * u-frame_size; +if (PA_UNLIKELY((snd_pcm_uframes_t) sframes != frames)) { +PA_ONCE_BEGIN { +pa_log_warn(ALSA mmap read was set up for %lu frames, but unexpectedly commited %lu frames.\n, +(unsigned long) frames, (unsigned long) sframes); +} PA_ONCE_END; +} + +got = frames * u-frame_size; +u-read_count += got; #ifdef DEBUG_TIMING -pa_log_debug(Read %lu bytes (of possible %lu bytes), (unsigned long) (frames * u-frame_size), (unsigned long) n_bytes); +pa_log_debug(Read %lu bytes (of possible %lu bytes), (unsigned long) got, (unsigned long) n_bytes); #endif -if ((size_t) frames * u-frame_size = n_bytes) +if (got = n_bytes) break; -n_bytes -= (size_t) frames * u-frame_size; +n_bytes -= got; } } -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Master is frozen
After reading the HSP spec some more, the volume controls are optional. It should be mentioned in the SDP if the remote volume is supported (with the BT assigned number 0x302 apparently). Not sure how to get to that info.. Wim On 14 November 2014 11:04, Arun Raghavan a...@accosted.net wrote: On 14 Nov 2014 15:31, Wim Taymans wim.taym...@gmail.com wrote: Can you compare with a hcidump of working volume? It never actually worked for me. If you have one that works, I can compare with what I get here ( well probably take a day or two). -- Arun ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] bluetooth: set gain correctly
Send the right command to set the speaker and microphone gain. --- src/modules/bluetooth/backend-native.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index 86af422..cea2db2 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -285,8 +285,8 @@ static void set_speaker_gain(pa_bluetooth_transport *t, uint16_t gain) { t-speaker_gain = gain; -len = sprintf(buf, AT+VGS=%d\r, gain); -pa_log_debug(RFCOMM AT+VGS=%d, gain); +len = sprintf(buf, +VGS=%d\r, gain); +pa_log_debug(RFCOMM +VGS=%d, gain); written = write(trfc-rfcomm_fd, buf, len); @@ -304,8 +304,8 @@ static void set_microphone_gain(pa_bluetooth_transport *t, uint16_t gain) { t-microphone_gain = gain; -len = sprintf(buf, AT+VGM=%d\r, gain); -pa_log_debug(RFCOMM AT+VGM=%d, gain); +len = sprintf(buf, +VGM=%d\r, gain); +pa_log_debug(RFCOMM +VGM=%d, gain); written = write (trfc-rfcomm_fd, buf, len); -- 1.9.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] modules: Disable timer scheduling for a2dp playback to reduce power consumption.
Hi Sajeesh, Thanks for trying to contribute to PulseAudio. While going through old patches I found this one, but as Pierre-Louis says below, I'm not sure how this would reduce power consumption. Could you explain? Or we could drop your patch in case you changed your mind. Thanks, On 2014-08-05 23:59, Pierre-Louis Bossart wrote: On 8/5/14, 12:35 AM, Sajeesh Sidharthan wrote: --- src/modules/bluetooth/module-bluez5-device.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 57b2791..eda7a9d 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -1170,10 +1170,10 @@ static void thread_func(void *userdata) { a2dp_reduce_bitpool(u); } } - -do_write = 1; -pending_read_bytes = 0; } + +do_write = 1; +pending_read_bytes = 0; } if (writable do_write 0) { @@ -1208,7 +1208,7 @@ static void thread_func(void *userdata) { sleep_for = PA_USEC_PER_MSEC * 500; pa_rtpoll_set_timer_relative(u-rtpoll, sleep_for); -disable_timer = false; +/* disable_timer = false; *//* Disable timer to reduce power consumption */ Why would this reduce power consumption, one would think that you want to buffer up by specifying a large latency. If you disable timers you'll have to force a specific buffer size for this sink. Thanks, -Pierre ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] shell-completion: zsh: Fix set-default-sink/source completion
On Sat, 2014-11-01 at 18:28 +0200, Tanu Kaskinen wrote: The _devices() function didn't recognize the set-default-* commands, and as a result it didn't generate any completions. --- shell-completion/zsh/_pulseaudio | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell-completion/zsh/_pulseaudio b/shell-completion/zsh/_pulseaudio index cbccaf2..4f4043a 100644 --- a/shell-completion/zsh/_pulseaudio +++ b/shell-completion/zsh/_pulseaudio @@ -19,6 +19,8 @@ _devices() { case $words[$((CURRENT - 1))] in set-sink-input-*) cmd=('sink-inputs');; set-sink-*) cmd=('sinks');; +set-default-sink) cmd=('sinks');; +set-default-source) cmd=('sources');; set-source-output-*) cmd=('source-outputs');; set-source-*) cmd=('sources');; suspend-sink) cmd=('sinks');; Applied. -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] shell-completion: zsh: Fix the set-card-profile description
On Sat, 2014-11-01 at 18:28 +0200, Tanu Kaskinen wrote: --- shell-completion/zsh/_pulseaudio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell-completion/zsh/_pulseaudio b/shell-completion/zsh/_pulseaudio index 4f4043a..e2390e8 100644 --- a/shell-completion/zsh/_pulseaudio +++ b/shell-completion/zsh/_pulseaudio @@ -248,7 +248,7 @@ _pactl_completion() { 'move-source-output: move a recording stream to a source' 'suspend-sink: suspend or resume a sink' 'suspend-source: suspend or resume a source' -'set-card-profile: set a card profile:cards:_cards' +'set-card-profile: set a card profile' 'set-default-sink: set the default sink' 'set-default-source: set the default source' 'set-sink-port: set the sink port of a sink' Applied. -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] dbus: Fix Device.SetActivePort() handler
On Sun, 2014-11-02 at 20:55 +0200, Tanu Kaskinen wrote: On Sun, 2014-11-02 at 20:50 +0200, Tanu Kaskinen wrote: The old code tried to look up the port object by using an object path, but the ports hashmap uses port names as keys, so the method failed always. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=85369 --- src/modules/dbus/iface-device.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) Note to self: if nothing else needs to be changed, at least the patch title needs to be corrected. It's the ActivePort property handler that is fixed, not the SetActivePort() method (there's no such thing). Applied (acked by David in IRC). -- Tanu ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] bluetooth: set gain correctly
Send the right command to set the speaker and microphone gain. Note that setting the volume on the Headset should use the unsolicited result code. Receiving the volume from the Headset uses the AT command. --- src/modules/bluetooth/backend-native.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index 86af422..8407672 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -285,8 +285,8 @@ static void set_speaker_gain(pa_bluetooth_transport *t, uint16_t gain) { t-speaker_gain = gain; -len = sprintf(buf, AT+VGS=%d\r, gain); -pa_log_debug(RFCOMM AT+VGS=%d, gain); +len = sprintf(buf, \r\n+VGS=%d\r\n, gain); +pa_log_debug(RFCOMM +VGS=%d, gain); written = write(trfc-rfcomm_fd, buf, len); @@ -304,8 +304,8 @@ static void set_microphone_gain(pa_bluetooth_transport *t, uint16_t gain) { t-microphone_gain = gain; -len = sprintf(buf, AT+VGM=%d\r, gain); -pa_log_debug(RFCOMM AT+VGM=%d, gain); +len = sprintf(buf, \r\n+VGM=%d\r\n, gain); +pa_log_debug(RFCOMM +VGM=%d, gain); written = write (trfc-rfcomm_fd, buf, len); -- 1.9.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] Fix the gain settings on Headset
This patch fixes the gain settings for Headsets by sending the right commands. It replaces the previous patch. Wim Taymans (1): bluetooth: set gain correctly src/modules/bluetooth/backend-native.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- 1.9.3 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] Notes from the PulseAudio Mini Summit 2014
Hi Arun, On Fri, Nov 14, 2014 at 3:05 AM, Arun Raghavan a...@accosted.net wrote: Hi folks, JFYI, I've posted notes from our mini summit at Düsseldorf: http://arunraghavan.net/2014/11/notes-from-the-pulseaudio-mini-summit-2014/ As I said on comments on your blog, thanks for the write up. I also would like to add a new discovery I made since: the systemd+realtime problem seems to happen only on CONFIG_RT_GROUP_SCHED=on systems. On systems without that option set, rtkit can get RT privileges without problem. Debian does not have that option set, and [1] suggests ubuntu doesn't either, so both should be OK for using rtkit with systemd. [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1284731 -- Saludos, Felipe Sateler ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 2/4] Enabled libsoxr resampler backend.
Added ID and names for the resampler presets and also corrected the working sample rate deduction to take the new resampler into account. Removed duplicate condition checks from the deduction code. --- src/pulsecore/resampler.c | 25 - src/pulsecore/resampler.h | 4 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 183d05f..8974db3 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -111,6 +111,17 @@ static int (* const init_table[])(pa_resampler *r) = { [PA_RESAMPLER_AUTO]= NULL, [PA_RESAMPLER_COPY]= copy_init, [PA_RESAMPLER_PEAKS] = pa_resampler_peaks_init, +#ifdef HAVE_SOXR +[PA_RESAMPLER_SOXR_LQ] = pa_resampler_soxr_init, +[PA_RESAMPLER_SOXR_MQ] = pa_resampler_soxr_init, +[PA_RESAMPLER_SOXR_HQ] = pa_resampler_soxr_init, +[PA_RESAMPLER_SOXR_VHQ]= pa_resampler_soxr_init, +#else +[PA_RESAMPLER_SOXR_LQ] = NULL, +[PA_RESAMPLER_SOXR_MQ] = NULL, +[PA_RESAMPLER_SOXR_HQ] = NULL, +[PA_RESAMPLER_SOXR_VHQ]= NULL, +#endif }; static pa_resample_method_t choose_auto_resampler(pa_resample_flags_t flags) { @@ -278,10 +289,11 @@ static pa_sample_format_t choose_work_format( } /* Else fall trough */ case PA_RESAMPLER_PEAKS: -if (a == PA_SAMPLE_S16NE || b == PA_SAMPLE_S16NE) -work_format = PA_SAMPLE_S16NE; -else if (sample_format_more_precise(a, PA_SAMPLE_S16NE) || - sample_format_more_precise(b, PA_SAMPLE_S16NE)) +case PA_RESAMPLER_SOXR_MQ: +case PA_RESAMPLER_SOXR_HQ: +case PA_RESAMPLER_SOXR_VHQ: +if (sample_format_more_precise(a, PA_SAMPLE_S16NE) || +sample_format_more_precise(b, PA_SAMPLE_S16NE)) work_format = PA_SAMPLE_FLOAT32NE; else work_format = PA_SAMPLE_S16NE; @@ -601,7 +613,10 @@ static const char * const resample_methods[] = { ffmpeg, auto, copy, -peaks +peaks, +soxr-mq, +soxr-hq, +soxr-vhq }; const char *pa_resample_method_to_string(pa_resample_method_t m) { diff --git a/src/pulsecore/resampler.h b/src/pulsecore/resampler.h index 5a84cf0..a0306e7 100644 --- a/src/pulsecore/resampler.h +++ b/src/pulsecore/resampler.h @@ -59,6 +59,9 @@ typedef enum pa_resample_method { PA_RESAMPLER_AUTO, /* automatic select based on sample format */ PA_RESAMPLER_COPY, PA_RESAMPLER_PEAKS, +PA_RESAMPLER_SOXR_MQ, +PA_RESAMPLER_SOXR_HQ, +PA_RESAMPLER_SOXR_VHQ, PA_RESAMPLER_MAX } pa_resample_method_t; @@ -163,6 +166,7 @@ int pa_resampler_libsamplerate_init(pa_resampler *r); int pa_resampler_peaks_init(pa_resampler *r); int pa_resampler_speex_init(pa_resampler *r); int pa_resampler_trivial_init(pa_resampler*r); +int pa_resampler_soxr_init(pa_resampler *r); /* Resampler-specific quirks */ bool pa_speex_is_fixed_point(void); -- 2.1.0 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 3/4] Added libsoxr detection and optional build of soxr resampler backend.
--- configure.ac| 17 + src/Makefile.am | 6 ++ 2 files changed, 23 insertions(+) diff --git a/configure.ac b/configure.ac index e91e990..4ae4838 100644 --- a/configure.ac +++ b/configure.ac @@ -1133,6 +1133,21 @@ AS_IF([test x$with_speex = xyes test x$HAVE_SPEEX = x0], AM_CONDITIONAL([HAVE_SPEEX], [test x$HAVE_SPEEX = x1]) AS_IF([test x$HAVE_SPEEX = x1], AC_DEFINE([HAVE_SPEEX], 1, [Have speex])) + soxr (optional) + +AC_ARG_WITH([soxr], +AS_HELP_STRING([--without-soxr],[Omit soxr (resampling)])) + +AS_IF([test x$with_soxr != xno], +[PKG_CHECK_MODULES(LIBSOXR, [ soxr = 0.1.1 ], HAVE_SOXR=1, HAVE_SOXR=0)], +HAVE_SOXR=0) + +AS_IF([test x$with_soxr = xyes test x$HAVE_SOXR = x0], +[AC_MSG_ERROR([*** soxr support not found])]) + +AM_CONDITIONAL([HAVE_SOXR], [test x$HAVE_SOXR = x1]) +AS_IF([test x$HAVE_SOXR = x1], AC_DEFINE([HAVE_SOXR], 1, [Have soxr])) + Xen support (optional) AC_ARG_ENABLE([xen], @@ -1524,6 +1539,7 @@ AS_IF([test x$HAVE_FFTW = x1], ENABLE_FFTW=yes, ENABLE_FFTW=no) AS_IF([test x$HAVE_ORC = xyes], ENABLE_ORC=yes, ENABLE_ORC=no) AS_IF([test x$HAVE_ADRIAN_EC = x1], ENABLE_ADRIAN_EC=yes, ENABLE_ADRIAN_EC=no) AS_IF([test x$HAVE_SPEEX = x1], ENABLE_SPEEX=yes, ENABLE_SPEEX=no) +AS_IF([test x$HAVE_SOXR = x1], ENABLE_SOXR=yes, ENABLE_SOXR=no) AS_IF([test x$HAVE_WEBRTC = x1], ENABLE_WEBRTC=yes, ENABLE_WEBRTC=no) AS_IF([test x$HAVE_TDB = x1], ENABLE_TDB=yes, ENABLE_TDB=no) AS_IF([test x$HAVE_GDBM = x1], ENABLE_GDBM=yes, ENABLE_GDBM=no) @@ -1585,6 +1601,7 @@ echo Enable orc:${ENABLE_ORC} Enable Adrian echo canceller: ${ENABLE_ADRIAN_EC} Enable speex (resampler, AEC): ${ENABLE_SPEEX} +Enable soxr (resampler): ${ENABLE_SOXR} Enable WebRTC echo canceller: ${ENABLE_WEBRTC} Enable gcov coverage: ${ENABLE_GCOV} Enable unit tests: ${ENABLE_TESTS} diff --git a/src/Makefile.am b/src/Makefile.am index 4e60a98..a2d2191 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1017,6 +1017,12 @@ libpulsecore_@PA_MAJORMINOR@_la_CFLAGS += $(LIBSPEEX_CFLAGS) libpulsecore_@PA_MAJORMINOR@_la_LIBADD += $(LIBSPEEX_LIBS) endif +if HAVE_SOXR +libpulsecore_@PA_MAJORMINOR@_la_SOURCES += pulsecore/resampler/soxr.c +libpulsecore_@PA_MAJORMINOR@_la_CFLAGS += $(LIBSOXR_CFLAGS) +libpulsecore_@PA_MAJORMINOR@_la_LIBADD += $(LIBSOXR_LIBS) +endif + if HAVE_LIBSAMPLERATE libpulsecore_@PA_MAJORMINOR@_la_SOURCES += pulsecore/resampler/libsamplerate.c libpulsecore_@PA_MAJORMINOR@_la_CFLAGS += $(LIBSAMPLERATE_CFLAGS) -- 2.1.0 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH v2 0/4] Add support for libsoxr resampler
This is an updated set of patches first announced and discussed here: http://comments.gmane.org/gmane.comp.audio.pulseaudio.general/22158 Changes to the original patches: * Removed the -lq quality preset, only -mq, -hq and -vhq presets are left. * Removed the fix to the sample_format_more_precise function as it was factored out to a separate patch, which was committed. * Changed the asserts in switch/case statements to the pa_assert_not_reached() macro and also some comments as suggested. * Explicitly provide runtime_spec with thread number 1 to soxr_create so that we're guaranteed to not use multithreading. This is equivalent to the previous code that relied on the default. * Changed choose_work_format() so that soxr uses the common case branch rather than its own. Removed the duplicate condition from it to simplify code slightly. * Updated docs so that it better describes pros and cons of the new resampler and its presets. Andrey Semashev (4): Added libsoxr resampler backend. Enabled libsoxr resampler backend. Added libsoxr detection and optional build of soxr resampler backend. Added documentation for soxr resampling methods. configure.ac | 17 + man/pulse-daemon.conf.5.xml.in | 14 +++- src/Makefile.am| 6 ++ src/pulsecore/resampler.c | 25 -- src/pulsecore/resampler.h | 4 + src/pulsecore/resampler/soxr.c | 170 + 6 files changed, 228 insertions(+), 8 deletions(-) create mode 100644 src/pulsecore/resampler/soxr.c -- 2.1.0 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 1/4] Added libsoxr resampler backend.
The new backend supports 3 quality levels: mq, hq and vhq; 16 integer and 32-bit float samples. Discussion and quality assessment are here: http://comments.gmane.org/gmane.comp.audio.pulseaudio.general/22158 --- src/pulsecore/resampler/soxr.c | 170 + 1 file changed, 170 insertions(+) create mode 100644 src/pulsecore/resampler/soxr.c diff --git a/src/pulsecore/resampler/soxr.c b/src/pulsecore/resampler/soxr.c new file mode 100644 index 000..c2fd8ee --- /dev/null +++ b/src/pulsecore/resampler/soxr.c @@ -0,0 +1,170 @@ +/*** + This file is part of PulseAudio. + + Copyright 2014 Andrey Semashev + + PulseAudio is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, + or (at your option) any later version. + + PulseAudio is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include stddef.h +#include soxr.h + +#include pulsecore/resampler.h + +static unsigned resampler_soxr_resample(pa_resampler *r, const pa_memchunk *input, unsigned in_n_frames, +pa_memchunk *output, unsigned *out_n_frames) { +soxr_t state; +void *in, *out; +size_t consumed = 0, produced = 0; + +pa_assert(r); +pa_assert(input); +pa_assert(output); +pa_assert(out_n_frames); + +state = r-impl.data; +pa_assert(state); + +in = pa_memblock_acquire_chunk(input); +out = pa_memblock_acquire_chunk(output); + +pa_assert_se(soxr_process(state, in, in_n_frames, consumed, out, *out_n_frames, produced) == 0); + +pa_memblock_release(input-memblock); +pa_memblock_release(output-memblock); + +*out_n_frames = produced; + +return in_n_frames - consumed; +} + +static void resampler_soxr_free(pa_resampler *r) { +pa_assert(r); + +if (!r-impl.data) +return; + +soxr_delete(r-impl.data); +r-impl.data = NULL; +} + +static void resampler_soxr_reset(pa_resampler *r) { +soxr_t old_state; + +pa_assert(r); + +/* + * soxr_clear() makes soxr_process() crash afterwards, + * so don't use this function until libsoxr is fixed. + * + * soxr_clear(r-impl.data); + */ + +old_state = r-impl.data; +r-impl.data = NULL; + +if (pa_resampler_soxr_init(r) == 0) { +if (old_state) +soxr_delete(old_state); +} else { +r-impl.data = old_state; +pa_log_error(Failed to reset libsoxr context); +} +} + +static void resampler_soxr_update_rates(pa_resampler *r) { +soxr_t old_state; + +pa_assert(r); + +/* There is no update method in libsoxr, + * so just re-create the resampler context */ + +old_state = r-impl.data; +r-impl.data = NULL; + +if (pa_resampler_soxr_init(r) == 0) { +if (old_state) +soxr_delete(old_state); +} else { +r-impl.data = old_state; +pa_log_error(Failed to update libsoxr sample rates); +} +} + +int pa_resampler_soxr_init(pa_resampler *r) { +soxr_t state; +soxr_datatype_t io_format; +soxr_io_spec_t io_spec; +soxr_runtime_spec_t runtime_spec; +unsigned long quality_recipe; +soxr_quality_spec_t quality; +soxr_error_t err = NULL; + +pa_assert(r); + +switch (r-work_format) { +case PA_SAMPLE_S16NE: +io_format = SOXR_INT16_I; +break; +case PA_SAMPLE_FLOAT32NE: +io_format = SOXR_FLOAT32_I; +break; +default: +pa_assert_not_reached(); +return -1; +} + +io_spec = soxr_io_spec(io_format, io_format); + +/* Resample in one thread. Multithreading makes + * performance worse with small chunks of audio. */ +runtime_spec = soxr_runtime_spec(1); + +switch (r-method) { +case PA_RESAMPLER_SOXR_MQ: +quality_recipe = SOXR_MQ | SOXR_LINEAR_PHASE; +break; +case PA_RESAMPLER_SOXR_VHQ: +quality_recipe = SOXR_VHQ | SOXR_LINEAR_PHASE; +break; +default: +pa_assert_not_reached(); +case PA_RESAMPLER_SOXR_HQ: +quality_recipe = SOXR_HQ | SOXR_LINEAR_PHASE; +break; +} + +quality = soxr_quality_spec(quality_recipe, 0); + +state = soxr_create(r-i_ss.rate, r-o_ss.rate, r-work_channels, err, io_spec, quality, runtime_spec); +if (!state) { +pa_log_error(Failed to create libsoxr resampler context: %s.,
[pulseaudio-discuss] [PATCH 4/4] Added documentation for soxr resampling methods.
--- man/pulse-daemon.conf.5.xml.in | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in index 754312e..f8ba9b4 100644 --- a/man/pulse-daemon.conf.5.xml.in +++ b/man/pulse-daemon.conf.5.xml.in @@ -88,7 +88,8 @@ USA. optsrc-sinc-medium-quality/opt, optsrc-sinc-fastest/opt, optsrc-zero-order-hold/opt, optsrc-linear/opt, opttrivial/opt, optspeex-float-N/opt, - optspeex-fixed-N/opt, optffmpeg/opt. See the + optspeex-fixed-N/opt, optffmpeg/opt, optsoxr-mq/opt, + optsoxr-hq/opt, optsoxr-vhq/opt. See the documentation of libsamplerate and speex for explanations of the different src- and speex- methods, respectively. The method opttrivial/opt is the most basic algorithm implemented. If @@ -98,8 +99,15 @@ USA. exist in two flavours: optfixed/opt and optfloat/opt. The former uses fixed point numbers, the latter relies on floating point numbers. On most desktop CPUs the float point resampler is a lot faster, and it - also offers slightly better quality. See the output of - optdump-resample-methods/opt for a complete list of all + also offers slightly better quality. The soxr- family methods + are based on libsoxr, a resampler library from SoX sound processing utility. + The mq variant has the best performance of the three. The hq is more expensive + and is considered the best choice for audio of up to 16 bits per sample. The vhq variant + has more precision than hq and is more suitable for larger samples. The Soxr resamplers + generally offer better quality at less CPU compared to other resamplers, such as speex. + The downside is that it can add a significant delay to the output + (usually, up to around 20 ms, in rare cases more). + See the output of optdump-resample-methods/opt for a complete list of all available resamplers. Defaults to optspeex-float-1/opt. The opt--resample-method/opt command line option takes precedence. Note that some modules overwrite or allow overwriting of the -- 2.1.0 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH 5/4] Removed leftover bits referring to soxr-lq.
--- These bits were left by accident when I was removing the soxr-lq from my patches. src/pulsecore/resampler.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index 8974db3..17919a3 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -112,12 +112,10 @@ static int (* const init_table[])(pa_resampler *r) = { [PA_RESAMPLER_COPY]= copy_init, [PA_RESAMPLER_PEAKS] = pa_resampler_peaks_init, #ifdef HAVE_SOXR -[PA_RESAMPLER_SOXR_LQ] = pa_resampler_soxr_init, [PA_RESAMPLER_SOXR_MQ] = pa_resampler_soxr_init, [PA_RESAMPLER_SOXR_HQ] = pa_resampler_soxr_init, [PA_RESAMPLER_SOXR_VHQ]= pa_resampler_soxr_init, #else -[PA_RESAMPLER_SOXR_LQ] = NULL, [PA_RESAMPLER_SOXR_MQ] = NULL, [PA_RESAMPLER_SOXR_HQ] = NULL, [PA_RESAMPLER_SOXR_VHQ]= NULL, -- 2.1.0 ___ pulseaudio-discuss mailing list pulseaudio-discuss@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss