David Henningsson | 3 Sep 09:43 2015

[PATCH] module: Always remove freed module from modules_pending_unload

pa_module_free is called from more than one place, not all of
these places correctly removed the module from the
modules_pending_unload array, potentially causing a dangling pointer
in that array.

Signed-off-by: David Henningsson <david.henningsson <at> canonical.com>
---

This was found while investigating Pierre's latest comment in
https://bugs.freedesktop.org/show_bug.cgi?id=90108

Pierre, can you see if this solves the problem for you?

 src/pulsecore/module.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 1d4187e..a83a706 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
 <at>  <at>  -248,6 +248,8  <at>  <at>  static void pa_module_free(pa_module *m) {

     lt_dlclose(m->dl);

+    pa_hashmap_remove(m->core->modules_pending_unload, m);
+
     pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);

     pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index);
 <at>  <at>  -264,8 +266,6  <at>  <at>  void pa_module_unload(pa_core *c, pa_module *m, bool force) {
(Continue reading)

Tom Yan | 30 Aug 16:15 2015
Picon

about module-suspend-on-idle (feature request: split modules for analog/digital?)

Hi all.

By default module-suspend-on-idle is loaded to "Automatically suspend
sinks/sources that become idle for too long", but it has been causing
problem to digital sinks (and probably sources as well).

For example, if you have used pulse with any HDMI/DP/SPDIF sound
devices, you would probably experience delays of output at the
begining of the playback (unless you were already playing something
through the same sink not too long ago). And if you pause the
playback, and resume it after some time, the delays also come.

But for analog output, this problem does not seem to exist.

I am not sure if this module really means much on, for example, power
saving, or other purposes that I didn't even think of, but probably it
exists for a reason (and there must be people who find it essential
anyway).  So I would like to suggest spliting the modules into two,
one for analog and one for digital, so that users can "fine tune" this
"suspend-on-idle" behaviour. And of course, if it's feasible to have
an option in certain config file instead, that would probably be a
better way (like, suspend-on-idle=analog/digital/both).
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Ahmed S. Darwish | 29 Aug 12:43 2015
Picon

[PATCH 1/2] scripts: Introduce helper utility benchmark_memory_usage.sh

Add shell script to sample PulseAudio memory usage (VmSize,
Private_Dirty + Shared_Dirty) while increasing the number of connected
'paplay' clients over time.

Linux kernel /proc/$PID/smaps fields Private and Shared_Dirty are used
to accurately measure the total size of used dirty pages over time.
This shall be useful for benchmarking the PA daemon's memory while
introducing new features like the exclusively per-client SHM access.

Also add an empty benchmarks collection directory 'benchmarks/'. All
output from the benchmarking tools shall be saved in this place, with
timestamps and symbolic links to the newest versions.

Signed-off-by: Ahmed S. Darwish <darwish.07 <at> gmail.com>
---
 scripts/benchmark_memory_usage.sh | 87 +++++++++++++++++++++++++++++++++++++++
 scripts/benchmarks/.gitignore     | 10 +++++
 scripts/benchmarks/README         |  4 ++
 3 files changed, 101 insertions(+)
 create mode 100755 scripts/benchmark_memory_usage.sh
 create mode 100644 scripts/benchmarks/.gitignore
 create mode 100644 scripts/benchmarks/README

diff --git a/scripts/benchmark_memory_usage.sh b/scripts/benchmark_memory_usage.sh
new file mode 100755
index 0000000..3687793
--- /dev/null
+++ b/scripts/benchmark_memory_usage.sh
 <at>  <at>  -0,0 +1,87  <at>  <at> 
+#!/bin/bash
(Continue reading)

Ahmed S. Darwish | 28 Aug 14:45 2015
Picon

[PATCH 0/2] Create srbchannel SHM files on a per-client basis

Hi everyone,

This is the start of an effort to make PulseAudio safely run under
system mode while using important features like low-latency
srbchannels. Hopefully, this effort will also interact with other
future paths like policy and sandboxing.

As we discussed in #pulseaudio ealier, for now, this patch
transforms the server-wide SHM file used by srbchannels into a
per-client one.

After proper review and inclusion of this patch, I shall modify
the srbchannel communication to direcly use memfds (yay!)

Thank you,

--

-- 
Darwish
http://darwish.chasingpointers.com
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Jiada Wang | 28 Aug 11:16 2015

sound is distorted when pulseaudio system timer scheduling is used (tsched=1)

Hello Community

I am having issue with pulseaudiosink,
I used following command to play a wav file
gst-launch filesrc location=<wav file path> ! wavparse ! pulseaudiosink

if tsched is enabled, then play of wav file via pulseaudiosink gives me 
lots of Underrun, and the sound is distorted, following is the 
pulseaudio log when --log-level=3

I: [pulseaudio] protocol-native.c: Got credentials: uid=0 gid=0 success=1
I: [pulseaudio] sink-input.c: Trying to change sample rate
I: [pulseaudio] alsa-sink.c: Updating rate for device hw:0, new rate is 
48000
I: [pulseaudio] source.c: Changed sampling rate successfully
I: [pulseaudio] sink.c: Changed sampling rate successfully
I: [pulseaudio] sink-input.c: Rate changed to 48000 Hz
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Trying resume...
I: [alsa-sink-HiFi wm8962-0] alsa-util.c: cannot disable ALSA period wakeups
I: [alsa-sink-HiFi wm8962-0] alsa-util.c: ALSA period wakeups were not 
disabled
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Time scheduling watermark is 
18.38ms
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Resumed successfully...
I: [alsa-sink-HiFi wm8962-0] alsa-sink.c: Starting playback.
I: [pulseaudio] sink-input.c: Created input 0 "pulsesink probe" on 
alsa_output.platform-sound.analog-s
tereo with sample spec s16le 2ch 48000Hz and channel map 
front-left,front-right
I: [pulseaudio] sink-input.c:     media.name = "pulsesink probe"
(Continue reading)

Zavadovsky Yan | 27 Aug 22:56 2015
Picon

[PATCH] build-sys: fix order of libraries installation

Libraries from modlibexec_LTLIBRARIES list require
not only libpulsecommon but also libpulse and
libpulsecore from lib_LTLIBRARIES list.

This patch fix race in 'make -j X install' (with X is 2 and more)
when building/installing inside chroot placed on RAM-disk(tmpfs).

Signed-off-by: Zavadovsky Yan <zavadovsky.yan <at> gmail.com>
---
 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 0c54d11..7f75a41 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
 <at>  <at>  -2260,7 +2260,7  <at>  <at>  installlibLTLIBRARIES = install-libLTLIBRARIES
 $(installlibLTLIBRARIES): install-pkglibLTLIBRARIES

 installmodlibexecLTLIBRARIES = install-modlibexecLTLIBRARIES
-$(installmodlibexecLTLIBRARIES): install-pkglibLTLIBRARIES
+$(installmodlibexecLTLIBRARIES): install-pkglibLTLIBRARIES install-libLTLIBRARIES

 installpadsplibLTLIBRARIES = install-padsplibLTLIBRARIES
 $(installpadsplibLTLIBRARIES): install-libLTLIBRARIES
--

-- 
2.5.0

_______________________________________________
pulseaudio-discuss mailing list
(Continue reading)

Tanu Kaskinen | 27 Aug 20:25 2015
Picon
Picon

[ANNOUNCE] PulseAudio 6.99.1

Good evening, citizens of Earth!

The first release candidate for PulseAudio 7.0 is now ready. Testing
and reporting found issues would be greatly appreciated. These are the
most significant changes since 6.0 (according to some undefined
criteria):

  * LFE channel synthesis with low-pass filtering
  * New libsoxr based resamplers
  * Socket activation support for TCP
  * The "srbchannel" IPC mechanism enabled by default
  * More flexible jack detection support when using UCM
  * Exiting due to SIGTERM isn't considered a failure

The full release notes draft is available here: 
http://freedesktop.org/wiki/Software/PulseAudio/Notes/7.0/

Download the tarballs here:

http://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-6.99.1.tar.xz
SHA1: 4c463999562e557801fb47e8ae363c3bb5460ee4
MD5: c808839d148ad248358415a7d66aa318

http://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-6.99.1.tar.gz
SHA1: 68573b78995e2d738f138c3a491cecb5a4fd3d05
MD5: cb9297744c633924f8e807a7d301237b

And finally, here's the git shortlog:

Ahmed S. Darwish (1):
(Continue reading)

Eytan Naim | 25 Aug 13:58 2015

HFP bluetooth profile isn't working

Hi,

 

I’m trying to enable HFP on pulseaudio 6.0 using oFono and bluez 5 on a new embedded platform which doesn’t support alsa yet.

In order to confirm that audio is ‘played’ I record it using parecord tool. – This method worked just fine when enabled a2dp a short time ago.

 

After executing oFono & pulseaudio, a call is answered on the remote device- It is seemed that the relevant profile is chosen on pulseaudio, and parecord fails to record.

 

When executing ‘pacmd stat’ it seems that

Memory blocks allocated during the whole lifetime: 192, size: 699.9 KiB.

Is constant while pulseaudio prints to terminal the following message along the call with relatively fixed intervals:

 

( 482.106|   0.013) D: [pulseaudio][modules/module-loopback.c:201 adjust_rates()] Should buffer 96 bytes, buffered at minimum 128 bytes

( 482.118|   0.012) D: [pulseaudio][modules/module-loopback.c:226 adjust_rates()] [bluez_sink.98_D6_F7_34_98_E8] Updated sampling rate to 8000 Hz.

( 482.132|   0.013) D: [pulseaudio][modules/module-loopback.c:197 adjust_rates()] Loopback overall latency is 610.13 ms + 0.00 ms + 25.00 ms = 635.13 ms

( 482.146|   0.014) D: [pulseaudio][modules/module-loopback.c:201 adjust_rates()] Should buffer 96 bytes, buffered at minimum 0 bytes

( 482.159|   0.012) D: [pulseaudio][modules/module-loopback.c:226 adjust_rates()] [bluez_sink.98_D6_F7_34_98_E8] Updated sampling rate to 8000 Hz.

( 492.134|   9.975) D: [pulseaudio][modules/module-loopback.c:197 adjust_rates()] Loopback overall latency is 610.13 ms + 8.00 ms + 0.00 ms = 618.13 ms

( 492.148|   0.013) D: [pulseaudio][modules/module-loopback.c:201 adjust_rates()] Should buffer 96 bytes, buffered at minimum 128 bytes

( 492.161|   0.012) D: [pulseaudio][modules/module-loopback.c:226 adjust_rates()] [bluez_sink.98_D6_F7_34_98_E8] Updated sampling rate to 8000 Hz.

( 492.175|   0.013) D: [pulseaudio][modules/module-loopback.c:197 adjust_rates()] Loopback overall latency is 610.13 ms + 0.00 ms + 25.00 ms = 635.13 ms

( 492.189|   0.014) D: [pulseaudio][modules/module-loopback.c:201 adjust_rates()] Should buffer 96 bytes, buffered at minimum 0 bytes

( 492.201|   0.012) D: [pulseaudio][modules/module-loopback.c:226 adjust_rates()] [bluez_sink.98_D6_F7_34_98_E8] Updated sampling rate to 8000 Hz.

( 502.176|   9.975) D: [pulseaudio][modules/module-loopback.c:197 adjust_rates()] Loopback overall latency is 610.13 ms + 8.00 ms + 0.00 ms = 618.13 ms

( 502.190|   0.013) D: [pulseaudio][modules/module-loopback.c:201 adjust_rates()] Should buffer 96 bytes, buffered at minimum 128 bytes

( 502.202|   0.012) D: [pulseaudio][modules/module-loopback.c:226 adjust_rates()] [bluez_sink.98_D6_F7_34_98_E8] Updated sampling rate to 8000 Hz.

( 502.216|   0.013) D: [pulseaudio][modules/module-loopback.c:197 adjust_rates()] Loopback overall latency is 610.13 ms + 0.00 ms + 25.00 ms = 635.13 ms

 

Please note:

I’m now familer with oFono at all – I simply run it as ofonod -d

Pacmd list output is attached while call is still ongoing. – there are 2 sources loaded and one sink.

               

Also, could someone explain why are there two source available? Nexus 4 and Nexus 4 monitor?

How can I confirm that the audio arrives at pulseaudio? By the log I would assume that the answer is positive, but according to ‘pacmd stat’ the value it seems not.

 

Thanks for your help,

Eytan.

pulse <at> OpenWrt:/$ pacmd list
( 580.160|   7.623) I: [pulseaudio][pulsecore/client.c:78 pa_client_new()] Created 12 "UNIX socket client"
Memory blocks currently allocated: 3, size: 5.7 KiB.
Memory blocks allocated during the whole lifetime: 192, size: 699.9 KiB.
Memory blocks imported from other processes: 0, size: 0 B.
Memory blocks exported to other processes: 0, size: 0 B.
Total sample cache size: 0 B.
Default sample spec: s16le 2ch 44100Hz
Default channel map: front-left,front-right
Default sink name: bluez_sink.98_D6_F7_34_98_E8
Default source name: bluez_source.98_D6_F7_34_98_E8
Memory blocks of type POOL: 3 allocated/192 accumulated.
Memory blocks of type POOL_EXTERNAL: 0 allocated/0 accumulated.
Memory blocks of type APPENDED: 0 allocated/0 accumulated.
Memory blocks of type USER: 0 allocated/0 accumulated.
Memory blocks of type FIXED: 0 allocated/0 accumulated.
Memory blocks of type IMPORTED: 0 allocated/0 accumulated.
22 module(s) loaded.
    index: 0
        name: <module-device-restore>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Automatically restore the volume/mute state of devices"
                module.version = "6.0-dirty"
    index: 1
        name: <module-stream-restore>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Automatically restore the volume/mute/device state of streams"
                module.version = "6.0-dirty"
    index: 2
        name: <module-card-restore>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Automatically restore profile of cards"
                module.version = "6.0-dirty"
    index: 3
        name: <module-augment-properties>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Augment the property sets of streams with additional static information"
                module.version = "6.0-dirty"
    index: 4
        name: <module-switch-on-port-available>
        argument: <>
        used: -1
        load once: no
        properties:

    index: 5
        name: <module-udev-detect>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Detect available audio hardware and load matching drivers"
                module.version = "6.0-dirty"
    index: 6
        name: <module-bluetooth-policy>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Frédéric Dalleau"
                module.description = "When a bluetooth sink or source is added, load module-loopback"
                module.version = "6.0-dirty"
    index: 7
        name: <module-bluetooth-discover>
        argument: <headset=ofono>
        used: -1
        load once: yes
        properties:
                module.author = "João Paulo Rechi Vita"
                module.description = "Detect available Bluetooth daemon and load the corresponding discovery module"
                module.version = "6.0-dirty"
    index: 8
        name: <module-bluez5-discover>
        argument: <headset=ofono>
        used: -1
        load once: yes
        properties:
                module.author = "João Paulo Rechi Vita"
                module.description = "Detect available BlueZ 5 Bluetooth audio devices and load BlueZ 5 Bluetooth audio drivers"
                module.version = "6.0-dirty"
    index: 9
        name: <module-esound-protocol-unix>
        argument: <>
        used: -1
        load once: no
        properties:
                module.author = "Lennart Poettering"
                module.description = "ESOUND protocol (UNIX sockets)"
                module.version = "6.0-dirty"
    index: 10
        name: <module-native-protocol-unix>
        argument: <>
        used: -1
        load once: no
        properties:
                module.author = "Lennart Poettering"
                module.description = "Native protocol (UNIX sockets)"
                module.version = "6.0-dirty"
    index: 11
        name: <module-default-device-restore>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Automatically restore the default sink and source"
                module.version = "6.0-dirty"
    index: 12
        name: <module-rescue-streams>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "When a sink/source is removed, try to move its streams to the default sink/source"
                module.version = "6.0-dirty"
    index: 13
        name: <module-always-sink>
        argument: <>
        used: -1
        load once: yes
        pr( 580.200|   0.040) D: [pulseaudio][pulsecore/cli.c:129 line_callback()] operties:
                module.author = "Colin Guthrie"
                module.description = "Always keeps at least one sink loaded even if it's a null one"
                module.version = "6.0-dirty"
    index: 15
        name: <module-intended-roles>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Automatically set device of streams based on intended roles of devices"
                module.version = "6.0-dirty"
    index: 16
        name: <module-suspend-on-idle>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "When a sink/source is idle for too long, suspend it"
                module.version = "6.0-dirty"
    index: 17
        name: <module-position-event-sounds>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Position event sounds between L and R depending on the position on screen of the
widget triggering them."
                module.version = "6.0-dirty"
    index: 18
        name: <module-role-cork>
        argument: <>
        used: -1
        load once: yes
        properties:
                module.author = "Lennart Poettering"
                module.description = "Mute & cork streams with certain roles while others exist"
                module.version = "6.0-dirty"
    index: 25
        name: <module-bluez5-device>
        argument: <path=/org/bluez/hci0/dev_98_D6_F7_34_98_E8>
        used: 4
        load once: no
        properties:

    index: 27
        name: <module-loopback>
        argument: <sink="bluez_sink.98_D6_F7_34_98_E8" sink_dont_move="true" source_output_properties="media.role=phone">
        used: -1
        load once: no
        properties:
                module.author = "Pierre-Louis Bossart"
                module.description = "Loopback from source to sink"
                module.version = "6.0-dirty"
    index: 28
        name: <module-loopback>
        argument: <source="bluez_source.98_D6_F7_34_98_E8" source_dont_move="true" sink_input_properties="media.role=phone">
        used: -1
        load once: no
        properties:
                module.author = "Pierre-Louis Bossart"
                module.description = "Loopback from source to sink"
                module.version = "6.0-dirty"
    index: 29
        name: <module-cli-protocol-unix>
        argument: <>
        used: -1
        load once: no
        properties:
                module.author = "Lennart Poettering"
                module.description = "Command line interface protocol (UNIX sockets)"
                module.version = "6.0-dirty"
1 sink(s) available.
  * index: 1
        name: <bluez_sink.98_D6_F7_34_98_E8>
        driver: <module-bluez5-device.c>
        flags: HARDWARE DECIBEL_VOLUME LATENCY FLAT_VOLUME
        state: RUNNING
        suspend cause:
        priority: 9030
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 610.13 ms
        max request: 0 KiB
        max rewind: 0 KiB
        monitor source: 5
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        used by: 2
        linked by: 3
        fixed latency: 128.00 ms
        card: 3 <bluez_card.98_D6_F7_34_98_E8>
        module: 25
        properties:
                bluetooth.protocol = "headset_audio_gateway"
                device.description = "Nexus 4"
                device.string = "98:D6:F7:34:98:E8"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "phone"
                bluez.path = "/org/bluez/hci0/dev_98_D6_F7_34_98_E8"
                bluez.class = "0x5a020c"
                bluez.alias = "Nexus 4"
                device.icon_name = "audio-card-bluetooth"
        ports:
                phone-output: Phone (priority 0, latency offset 0 usec, available: yes)
                        properties:

        active port: <phone-output>
2 source(s) available.
    index: 5
        name: <bluez_sink.98_D6_F7_34_98_E8.monitor>
        driver: <module-bluez5-device.c>
        flags: DECIBEL_VOLUME LATENCY
        state: RUNNING
        suspend cause:
        priority: 1030
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 0.00 ms
        max rewind: 0 KiB
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        used by: 1
        linked by: 1
        fixed latency: 128.00 ms
        monitor_of: 1
        card: 3 <bluez_card.98_D6_F7_34_98_E8>
        module: 25
        properties:
                device.description = "Monitor of Nexus 4"
                device.class = "monitor"
                device.string = "98:D6:F7:34:98:E8"
                device.api = "bluez"
                device.bus = "bluetooth"
                devCLI got EOF from user.
( 580.957|   0.756) ice.form_factor = "phone"
                bluez.path = "/org/bluez/hci0/dev_98_D6_F7_34_98_E8"
                bluez.class = "0x5a020c"
                bluez.alias = "Nexus 4"
                device.icon_name = "audio-card-bluetooth"
  * index: 6
        name: <bluez_source.98_D6_F7_34_98_E8>
        driver: <module-bluez5-device.c>
        flags: HARDWARE DECIBEL_VOLUME LATENCY
        state: RUNNING
        suspend cause:
        priority: 9030
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 25.00 ms
        max rewind: 0 KiB
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        used by: 1
        linked by: 1
        fixed latency: 28.00 ms
        card: 3 <bluez_card.98_D6_F7_34_98_E8>
        module: 25
        properties:
                bluetooth.protocol = "headset_audio_gateway"
                device.description = "Nexus 4"
                device.string = "98:D6:F7:34:98:E8"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "phone"
                bluez.path = "/org/bluez/hci0/dev_98_D6_F7_34_98_E8"
                bluez.class = "0x5a020c"
                bluez.alias = "Nexus 4"
                device.icon_name = "audio-card-bluetooth"
        ports:
                phone-input: Phone (priority 0, latency offset 0 usec, available: yes)
                        properties:

        active port: <phone-input>
1 client(s) logged in.
    index: 12
        driver: <cli.c>
        owner module: 29
        properties:
                application.name = "UNIX socket client"
1 card(s) available.
    index: 3
        name: <bluez_card.98_D6_F7_34_98_E8>
        driver: <module-bluez5-device.c>
        owner module: 25
        properties:
                device.description = "Nexus 4"
                device.string = "98:D6:F7:34:98:E8"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "phone"
                bluez.path = "/org/bluez/hci0/dev_98_D6_F7_34_98_E8"
                bluez.class = "0x5a020c"
                bluez.alias = "Nexus 4"
                device.icon_name = "audio-card-bluetooth"
        profiles:
                a2dp_source: High Fidelity Capture (A2DP Source) (priority 10, available: unknown)
                headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (priority 20, available: yes)
                off: Off (priority 0, available: yes)
        active profile: <headset_audio_gateway>
        sinks:
                bluez_sink.98_D6_F7_34_98_E8/#1: Nexus 4
        sources:
                bluez_sink.98_D6_F7_34_98_E8.monitor/#5: Monitor of Nexus 4
                bluez_source.98_D6_F7_34_98_E8/#6: Nexus 4
        ports:
                phone-output: Phone (priority 0, latency offset 0 usec, available: yes)
                        properties:

                phone-input: Phone (priority 0, latency offset 0 usec, available: yes)
                        properties:

2 sink input(s) available.
    index: 4
        driver: <module-loopback.c>
        flags: VARIABLE_RATE DONT_MOVE START_CORKED
        state: RUNNING
        sink: 1 <bluez_sink.98_D6_F7_34_98_E8>
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 8.00 ms
        requested latency: 128.00 ms
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        resample method: speex-fixed-1
        module: 27
        properties:
                media.role = "abstract"
                module-stream-restore.id = "sink-input-by-media-role:abstract"
                media.name = "Loopback from Monitor of Nexus 4"
    index: 5
        driver: <module-loopback.c>
        flags: VARIABLE_RATE START_CORKED
        state: DRAINED
        sink: 1 <bluez_sink.98_D6_F7_34_98_E8>
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 0.00 ms
        requested latency: 128.00 ms
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        resample method: speex-fixed-1
        module: 28
        properties:
                media.role = "phone"
                module-stream-restore.id = "sink-input-by-media-role:phone"
                media.name = "Loopback from Nexus 4"
                media.icon_name = "audio-card-bluetooth"
2 source output(s) available.
    index: 7
        driver: <module-loopback.c>
        flags: START_CORKED
        state: RUNNING
        source: 5 <bluez_sink.98_D6_F7_34_98_E8.monitor>
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 0.00 ms
        requested latency: 128.00 ms
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        resample method: (null)
        owner module: 27
        properties:
                media.role = "phone"
                module-stream-restore.id = "source-output-by-media-role:phone"
                media.name = "Loopback to Nexus 4"
I: [pulseaudio][pulsecore/client.c:100 pa_client_free()] Freed 12 "UNIX socket client"         
media.icon_name = "audio-card-bluetooth"
    index: 8
        driver: <module-loopback.c>
        flags: DONT_MOVE START_CORKED
        state: RUNNING
        source: 6 <bluez_source.98_D6_F7_34_98_E8>
        volume: mono: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 0.00 ms
        requested latency: 28.00 ms
        sample spec: s16le 1ch 8000Hz
        channel map: mono
                     Mono
        resample method: (null)
        owner module: 28
        properties:
                media.role = "abstract"
                module-stream-restore.id = "source-output-by-media-role:abstract"
                media.name = "Loopback to Nexus 4"
                media.icon_name = "audio-card-bluetooth"
0 cache entrie(s) available.
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Joonas Govenius | 21 Aug 22:29 2015
Picon

[PATCH] Run a user specified program on suspend/resume.

This allows calling a user-specified external program whenever a
source or sink is suspended or resumed (by specifying
external_suspend_handler="<path_to_executable>" as an option to
module-suspend-on-idle). The external executable is called
with "--suspended" or "--resumed" followed by "--source
<source_name>" or "--sink <sink_name>".

My use case for this feature is to cut the power to my active
speakers in order to eliminate hissing. I've been using the patch
(applied to pulseaudio 4.0) on Ubuntu 14.04 since February. I
have not tested it with later versions, except to check that it
compiles. I could do some further testing if the patch is
otherwise acceptable/useful enough.

Some things I'm not sure about:

* What happens on Windows? Does fork() work and if not, what does
  it return? Maybe some of the code should be wrapped
  with "#ifndef OS_IS_WIN32".

* Security considerations? This might provide a sneaky way to run
  malicious code repeatedly, but only if you have write access to
  the config file. In that case you are probably screwed in a
  multitude of ways already...

* What would be the correct place to document the new
  option. Maybe
  http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#index62h3
  ?

---
 src/modules/module-suspend-on-idle.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index f7620db..f21c7cc 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
 <at>  <at>  -21,6 +21,8  <at>  <at> 
 #include <config.h>
 #endif

+#include <unistd.h>
+
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
 #include <pulse/rtclock.h>
 <at>  <at>  -38,10 +40,11  <at>  <at>  PA_MODULE_AUTHOR("Lennart Poettering");
 PA_MODULE_DESCRIPTION("When a sink/source is idle for too long, suspend it");
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(true);
-PA_MODULE_USAGE("timeout=<timeout>");
+PA_MODULE_USAGE("timeout=<timeout>, external_suspend_handler=<executable called whenever a
sink/source is suspended/resumed>");

 static const char* const valid_modargs[] = {
     "timeout",
+    "external_suspend_handler",
     NULL,
 };

 <at>  <at>  -49,6 +52,7  <at>  <at>  struct userdata {
     pa_core *core;
     pa_usec_t timeout;
     pa_hashmap *device_infos;
+    const char *external_suspend_handler;
 };

 struct device_info {
 <at>  <at>  -60,6 +64,24  <at>  <at>  struct device_info {
     pa_usec_t timeout;
 };

+static void call_external_suspend_handler(bool is_suspended, struct device_info *d) {
+    /* is_suspended --> whether suspending or resuming */
+    if (d->userdata->external_suspend_handler) {
+        const char* c = d->userdata->external_suspend_handler;
+
+        pa_log_debug("Calling external %s handler: %s", is_suspended ? "suspend" : "resume", c);
+        if (fork() == 0) {
+            execl(c, c, is_suspended ? "--suspended" : "--resumed", (d->sink) ? "--sink" : "--source",
+                  (d->sink) ? d->sink->name : d->source->name, NULL);
+
+            pa_log_debug("Failed to execute external suspend/resume handler "
+                         "(Is the following a valid path to an executable file?): %s", c);
+            /* This is normal if the user-specified path is invalid, so terminate the child process quietly. */
+            _exit(3);
+        }
+    }
+}
+
 static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval *t, void *userdata) {
     struct device_info *d = userdata;

 <at>  <at>  -69,12 +91,14  <at>  <at>  static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval

     if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) {
         pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name);
+        call_external_suspend_handler(true, d);
         pa_sink_suspend(d->sink, true, PA_SUSPEND_IDLE);
         pa_core_maybe_vacuum(d->userdata->core);
     }

     if (d->source && pa_source_check_suspend(d->source) <= 0 && !(d->source->suspend_cause &
PA_SUSPEND_IDLE)) {
         pa_log_info("Source %s idle for too long, suspending ...", d->source->name);
+        call_external_suspend_handler(true, d);
         pa_source_suspend(d->source, true, PA_SUSPEND_IDLE);
         pa_core_maybe_vacuum(d->userdata->core);
     }
 <at>  <at>  -102,11 +126,13  <at>  <at>  static void resume(struct device_info *d) {

     if (d->sink) {
         pa_log_debug("Sink %s becomes busy, resuming.", d->sink->name);
+        call_external_suspend_handler(false, d);
         pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE);
     }

     if (d->source) {
         pa_log_debug("Source %s becomes busy, resuming.", d->source->name);
+        call_external_suspend_handler(false, d);
         pa_source_suspend(d->source, false, PA_SUSPEND_IDLE);
     }
 }
 <at>  <at>  -439,6 +465,10  <at>  <at>  int pa__init(pa_module*m) {
     u->timeout = timeout * PA_USEC_PER_SEC;
     u->device_infos = pa_hashmap_new_full(pa_idxset_trivial_hash_func,
pa_idxset_trivial_compare_func, NULL, (pa_free_cb_t) device_info_free);

+    u->external_suspend_handler = pa_modargs_get_value(ma, "external_suspend_handler", NULL);
+    if (u->external_suspend_handler)
+        u->external_suspend_handler = pa_xstrdup(u->external_suspend_handler);
+
     PA_IDXSET_FOREACH(sink, m->core->sinks, idx)
         device_new_hook_cb(m->core, PA_OBJECT(sink), u);

 <at>  <at>  -486,5 +516,8  <at>  <at>  void pa__done(pa_module*m) {

     pa_hashmap_free(u->device_infos);

+    if (u->external_suspend_handler)
+      pa_xfree((char *) u->external_suspend_handler);
+
     pa_xfree(u);
 }
--

-- 
1.9.1

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
johny why | 23 Aug 09:33 2015
Picon

Scale Volume to 153%

hi, How can the volume slider be scaled to the full 153% of the speaker output slider, instead of being restricted to max 100%? on linux mint xfce. sorry if wrong place to ask. thx!
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
Lars Hupel | 24 Aug 09:04 2015

Noise when trying to record audio

Hello,

I'm running Arch Linux and PulseAudio 6.0 on a Dell Latitude laptop. Sound
output works just fine, both headphones and internal speakers. Sound
recording however doesn't work. Initially, all I got was silence when
attempting to record (tried it with Audacity, arecord, parecord and
Skype). Then, I deleted my configuration (~/.config/pulse) and
restarted; now I get some weird form of noise when recording*. This
happens both for the internal and an external mic. I checked pavucontrol
and the device is unmuted.

* Here's a short sample of what Audacity records:
<http://nagini.eu/~lars/recording.ogg>

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: 92HD93BXX Analog [92HD93BXX Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

$ lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset
Family High Definition Audio Controller (rev 04)

Cheers
Lars

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss <at> lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Gmane