Algo (ALSA ou pulseaudio) altera o volume do dissipador ao conectar o bluetooth

1

O problema

Estou configurando um pequeno computador Linux (C.H.I.P.) para ser um receptor bluetooth usando pulseaudio. O dispositivo é sem cabeça, então eu gostaria de obter uma configuração que funcione na inicialização. Tudo está bem, exceto quando meu telefone se conecta a C.H.I.P. algo sempre define seu volume de coletor como 0%.

Como faço para que o Pulse / ALSA deixe o volume principal sozinho quando o pulseaudio configura a entrada sink? Ou talvez o pulso seja o culpado - não tenho certeza.

Coisas que tentei

  • Removendo module-*-restore do pulseaudio.
  • Configurando volumes simples para não
  • alsactl store
  • Adicionando uma diretiva a system.pa e / ou default.pa para fazer o pulseaudio definir o volume desse coletor para 100%

Se eu estiver executando o alsamixer enquanto meu telefone se conecta, vejo o volume passar de 100% para 0% em torno da seguinte linha de registro:

D: [pulseaudio] protocol-native.c: Client amixer changes volume of sink alsa_output.platform-1c22c00.codec.analog-stereo.

A configuração

  • Bluez anuncia como um dispositivo de mídia / coletor
  • O Pulseaudio é executado como uma instância do sistema (sim, sei por que isso é ruim)
  • Ele assiste bluez para conexões
  • Quando meu telefone se conecta, o PA configura uma entrada de loopback para o coletor ALSA
  • ALSA prontamente define o volume como 0%. Isso acontece todas as vezes meu telefone se conecta via bluetooth

Tudo o que tenho que fazer é executar o alsamixer e definir o volume do Master para 100%.

Muito mais informação

Aqui está a minha mensagem para pulseaudio-discuss (zero respostas a partir desta escrita).

As linhas de log de depuração próximas:

I: [pulseaudio] client.c: Created 26 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Client authenticated anonymously.
D: [pulseaudio] protocol-native.c: Protocol version: remote 29, local 29
D: [pulseaudio] protocol-native.c: SHM possible: no
D: [pulseaudio] protocol-native.c: Negotiated SHM: no
D: [pulseaudio] protocol-native.c: Client amixer changes volume of sink alsa_output.platform-1c22c00.codec.analog-stereo.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Requested to rewind 524288 bytes.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Limited to 18200 bytes.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: before: 2275
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: after: 2275
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Rewound 18200 bytes.
D: [alsa-sink-CDC PCM Codec-0] sink.c: Processing rewind...
D: [alsa-sink-CDC PCM Codec-0] sink-input.c: Have to rewind 18200 bytes on render memblockq.
D: [alsa-sink-CDC PCM Codec-0] source.c: Processing rewind...
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port sink:alsa_output.platform-1c22c00.codec.analog-stereo:analog-output.
I: [pulseaudio] client.c: Freed 26 "ALSA plug-in [amixer]"
I: [pulseaudio] protocol-native.c: Connection died.

A depuração da conexão completa.

D: [pulseaudio] bluez5-util.c: Properties changed in device /org/bluez/hci0/dev_1C_56_FE_9D_1B_0E
D: [pulseaudio] bluez4-util.c: dbus: interface=org.freedesktop.DBus.Properties, path=/org/bluez/hci0/dev_1C_56_FE_9D_1B_0E, member=PropertiesChanged
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaTransport1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez4-util.c: dbus: interface=org.freedesktop.DBus.ObjectManager, path=/, member=InterfacesAdded
D: [pulseaudio] bluez4-util.c: dbus: interface=org.bluez.MediaEndpoint1, path=/MediaEndpoint/A2DPSink, member=SetConfiguration
D: [pulseaudio] bluez5-util.c: dbus: path=/MediaEndpoint/A2DPSink, interface=org.bluez.MediaEndpoint1, member=SetConfiguration
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_1C_56_FE_9D_1B_0E/fd11 state changed from disconnected to idle
D: [pulseaudio] module-bluez5-discover.c: Loading module-bluez5-device path=/org/bluez/hci0/dev_1C_56_FE_9D_1B_0E
I: [pulseaudio] card.c: Created 4 "bluez_card.1C_56_FE_9D_1B_0E"
D: [pulseaudio] module-bluez5-device.c: Acquiring transport /org/bluez/hci0/dev_1C_56_FE_9D_1B_0E/fd11
I: [pulseaudio] bluez5-util.c: Failed optional acquire of unavailable transport /org/bluez/hci0/dev_1C_56_FE_9D_1B_0E/fd11
I: [pulseaudio] module-bluez5-device.c: SBC parameters: allocation=0, subbands=1, blocks=3, bitpool=2
D: [pulseaudio] module-device-restore.c: Database contains invalid data for key: source:bluez_source.1C_56_FE_9D_1B_0E:null
I: [pulseaudio] source.c: Created source 5 "bluez_source.1C_56_FE_9D_1B_0E" with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [pulseaudio] source.c:     bluetooth.protocol = "a2dp_source"
I: [pulseaudio] source.c:     device.description = "MotoG3"
I: [pulseaudio] source.c:     device.string = "1C:56:FE:9D:1B:0E"
I: [pulseaudio] source.c:     device.api = "bluez"
I: [pulseaudio] source.c:     device.class = "sound"
I: [pulseaudio] source.c:     device.bus = "bluetooth"
I: [pulseaudio] source.c:     device.form_factor = "phone"
I: [pulseaudio] source.c:     bluez.path = "/org/bluez/hci0/dev_1C_56_FE_9D_1B_0E"
I: [pulseaudio] source.c:     bluez.class = "0x5a020c"
I: [pulseaudio] source.c:     bluez.alias = "MotoG3"
I: [pulseaudio] source.c:     device.icon_name = "audio-card-bluetooth"
D: [bluetooth] module-bluez5-device.c: IO Thread starting up
D: [pulseaudio] module-suspend-on-idle.c: Source bluez_source.1C_56_FE_9D_1B_0E becomes idle, timeout in 5 seconds.
D: [pulseaudio] sink-input.c: Negotiated format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2" format.channel_map = "\"front-left,front-right\""
D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.platform-1c22c00.codec.analog-stereo becomes busy, resuming.
D: [pulseaudio] sink.c: Suspend cause of sink alsa_output.platform-1c22c00.codec.analog-stereo is 0x0000, resuming
I: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Trying resume...
I: [alsa-sink-CDC PCM Codec-0] alsa-util.c: cannot disable ALSA period wakeups
D: [alsa-sink-CDC PCM Codec-0] alsa-util.c: Maximum hw buffer size is 1489 ms
D: [alsa-sink-CDC PCM Codec-0] alsa-util.c: Set buffer size first (to 65536 samples), period size second (to 8192 samples).
I: [alsa-sink-CDC PCM Codec-0] alsa-util.c: ALSA period wakeups were not disabled
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: hwbuf_unused=0
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: setting avail_min=64656
I: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Time scheduling watermark is 20.00ms
I: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Resumed successfully...
D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.platform-1c22c00.codec.analog-stereo becomes idle, timeout in 5 seconds.
I: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Starting playback.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.platform-1c22c00.codec.analog-stereo becomes idle, timeout in 5 seconds.
I: [pulseaudio] resampler.c: Resampler 'ffmpeg' cannot do variable rate, reverting to resampler 'auto'.
D: [pulseaudio] resampler.c: Resampler:
D: [pulseaudio] resampler.c:   rate 44100 -> 44000 (method speex-fixed-1)
D: [pulseaudio] resampler.c:   format s16le -> s32le (intermediate s16le)
D: [pulseaudio] resampler.c:   channels 2 -> 2 (resampling 2)
I: [pulseaudio] resampler.c: Choosing speex quality setting 1.
D: [pulseaudio] memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=8, prebuf=0, minreq=1 maxrewind=0
D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=8, prebuf=0, minreq=8 maxrewind=0
I: [pulseaudio] sink-input.c: Created input 3 "(null)" on alsa_output.platform-1c22c00.codec.analog-stereo with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [pulseaudio] sink-input.c:     media.role = "music"
I: [pulseaudio] sink-input.c:     module-stream-restore.id = "sink-input-by-media-role:music"
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [pulseaudio] module-stream-restore.c: Not restoring device for stream source-output-by-media-role:abstract, because already set
D: [pulseaudio] source-output.c: Negotiated format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
D: [pulseaudio] module-suspend-on-idle.c: Source bluez_source.1C_56_FE_9D_1B_0E becomes busy, resuming.
D: [pulseaudio] module-suspend-on-idle.c: Source bluez_source.1C_56_FE_9D_1B_0E becomes idle, timeout in 5 seconds.
D: [pulseaudio] memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: [pulseaudio] source-output.c: Created output 3 "(null)" on bluez_source.1C_56_FE_9D_1B_0E with sample spec s16le 2ch 44100Hz and channel map front-left,front-right
I: [pulseaudio] source-output.c:     media.role = "abstract"
I: [pulseaudio] source-output.c:     module-stream-restore.id = "source-output-by-media-role:abstract"
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [pulseaudio] memblockq.c: memblockq requested: maxlength=16777216, tlength=16777216, base=4, prebuf=0, minreq=0 maxrewind=0
D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=16777216, tlength=16777216, base=4, prebuf=0, minreq=4 maxrewind=0
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Cutting sleep time for the initial iterations by half.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Latency set to 66.67ms
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: hwbuf_unused=500824
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: setting avail_min=64657
I: [alsa-sink-CDC PCM Codec-0] module-loopback.c: Max request changed
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Requesting rewind due to latency change.
I: [alsa-sink-CDC PCM Codec-0] module-loopback.c: Max request changed
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Requested to rewind 524288 bytes.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Limited to 518560 bytes.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: before: 64820
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: after: 64820
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Rewound 518560 bytes.
D: [alsa-sink-CDC PCM Codec-0] sink.c: Processing rewind...
D: [alsa-sink-CDC PCM Codec-0] sink-input.c: Have to rewind 518560 bytes on render memblockq.
D: [alsa-sink-CDC PCM Codec-0] source.c: Processing rewind...
I: [bluetooth] module-loopback.c: Skipping 0 bytes
D: [pulseaudio] module-suspend-on-idle.c: Source bluez_source.1C_56_FE_9D_1B_0E becomes busy, resuming.
D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
I: [pulseaudio] module.c: Loaded "module-loopback" (index: #22; argument: "source="bluez_source.1C_56_FE_9D_1B_0E" source_dont_move="true" sink_input_properties="media.role=music"").
I: [pulseaudio] module.c: Loaded "module-bluez5-device" (index: #21; argument: "path=/org/bluez/hci0/dev_1C_56_FE_9D_1B_0E").
D: [pulseaudio] bluez5-util.c: Transport /org/bluez/hci0/dev_1C_56_FE_9D_1B_0E/fd11 available for profile a2dp_source
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Introspectable found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.bluez.MediaPlayer1 found, skipping
D: [pulseaudio] bluez5-util.c: Unknown interface org.freedesktop.DBus.Properties found, skipping
D: [pulseaudio] bluez4-util.c: dbus: interface=org.freedesktop.DBus.ObjectManager, path=/, member=InterfacesAdded
D: [pulseaudio] bluez5-util.c: Properties changed in adapter /org/bluez/hci0
D: [pulseaudio] bluez4-util.c: dbus: interface=org.freedesktop.DBus.Properties, path=/org/bluez/hci0, member=PropertiesChanged
I: [pulseaudio] client.c: Created 25 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Client authenticated anonymously.
I: [pulseaudio] client.c: Freed 25 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Connection died.
I: [pulseaudio] client.c: Created 26 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Client authenticated anonymously.
D: [pulseaudio] protocol-native.c: Protocol version: remote 29, local 29
D: [pulseaudio] protocol-native.c: SHM possible: no
D: [pulseaudio] protocol-native.c: Negotiated SHM: no
D: [pulseaudio] protocol-native.c: Client amixer changes volume of sink alsa_output.platform-1c22c00.codec.analog-stereo.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Requested to rewind 524288 bytes.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Limited to 18200 bytes.
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: before: 2275
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: after: 2275
D: [alsa-sink-CDC PCM Codec-0] alsa-sink.c: Rewound 18200 bytes.
D: [alsa-sink-CDC PCM Codec-0] sink.c: Processing rewind...
D: [alsa-sink-CDC PCM Codec-0] sink-input.c: Have to rewind 18200 bytes on render memblockq.
D: [alsa-sink-CDC PCM Codec-0] source.c: Processing rewind...
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port sink:alsa_output.platform-1c22c00.codec.analog-stereo:analog-output.
I: [pulseaudio] client.c: Freed 26 "ALSA plug-in [amixer]"
I: [pulseaudio] protocol-native.c: Connection died.
I: [pulseaudio] client.c: Created 27 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Client authenticated anonymously.
D: [pulseaudio] protocol-native.c: Protocol version: remote 29, local 29
D: [pulseaudio] protocol-native.c: SHM possible: no
D: [pulseaudio] protocol-native.c: Negotiated SHM: no
I: [pulseaudio] client.c: Freed 27 "ALSA plug-in [amixer]"
I: [pulseaudio] protocol-native.c: Connection died.
I: [pulseaudio] client.c: Created 28 "Native client (UNIX socket client)"
I: [pulseaudio] protocol-native.c: Client authenticated anonymously.
D: [pulseaudio] protocol-native.c: Protocol version: remote 29, local 29
D: [pulseaudio] protocol-native.c: SHM possible: no
D: [pulseaudio] protocol-native.c: Negotiated SHM: no
I: [pulseaudio] client.c: Freed 28 "pactl"
I: [pulseaudio] protocol-native.c: Connection died.

/etc/pulse/daemon.conf

daemonize = no
allow-module-loading = yes
allow-exit = no
use-pid-file = yes
system-instance = yes
high-priority = yes
realtime-scheduling = no
log-target = journal
resample-method = ffmpeg
enable-remixing = no
enable-lfe-remixing = no
flat-volumes = yes
default-sample-format = s32le
default-sample-rate = 44000
alternate-sample-rate = 192000
default-sample-channels = 2
default-fragments = 10
default-fragment-size-msec = 50

/etc/pulse/client.conf

extra-arguments = --log-target=syslog --system --disallow-exit -v

/etc/pulse/system.pa

.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix auth-anonymous=1
.endif
load-module module-native-protocol-unix auth-anonymous=1
load-module module-stream-restore
load-module module-device-restore
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-suspend-on-idle
load-module module-position-event-sounds
load-module module-bluetooth-discover
load-module module-bluetooth-policy
load-module module-switch-on-connect

/etc/pulse/default.pa

.nofail
.fail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-augment-properties
load-module module-switch-on-port-available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-intended-roles
load-module module-suspend-on-idle
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif
load-module module-position-event-sounds
load-module module-role-cork
load-module module-filter-heuristics
load-module module-filter-apply

A entrada do coletor que fica "desativada".

0 ol-blue /etc/pulse # pactl list sink-inputs
Sink Input #0
    Driver: module-loopback.c
    Owner Module: 16
    Client: n/a
    Sink: 0
    Sample Specification: s16le 2ch 44100Hz
    Channel Map: front-left,front-right
    Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100" format.channels = "2"  format.channel_map = "\"front-left,front-right\""
    Corked: yes
    Mute: no
    Volume: front-left: 1 /   0% / -288.99 d,   front-right: 1 /   0% /
-288.99 d
            balance 0.00
    Buffer Latency: 0 usec
    Sink Latency: 0 usec
    Resample method: speex-fixed-1
    Properties:
        media.role = "music"
        module-stream-restore.id = "sink-input-by-media-role:music"
        media.name = "Loopback from MotoG3"
        media.icon_name = "audio-card-bluetooth"

O coletor ALSA:

0 ol-blue /etc/pulse # pactl list sinks
Sink #0
    State: SUSPENDED
    Name: alsa_output.platform-1c22c00.codec.analog-stereo
    Description: sun4i-codec Analog Stereo
    Driver: module-alsa-card.c
    Sample Specification: s32le 2ch 44000Hz
    Channel Map: front-left,front-right
    Owner Module: 1
    Mute: no
    Volume: front-left: 1 /   0% / -288.99 d,   front-right: 1 /   0% / -288.99 d
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor Source: alsa_output.platform-1c22c00.codec.analog-stereo.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY
    Properties:
        alsa.resolution_bits = "24"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = ""
        alsa.id = "CDC PCM Codec-0"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "sun4i-codec"
        alsa.long_card_name = "sun4i-codec"
        alsa.driver_name = "sun4i_codec"
        device.bus_path = "platform-1c22c00.codec"
        sysfs.path = "/devices/platform/soc at 01c00000 /1c22c00.codec/sound/card0"
        device.string = "hw:0"
        device.buffering.buffer_size = "524288"
        device.buffering.fragment_size = "65536"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Analog Stereo"
        device.description = "sun4i-codec Analog Stereo"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card"
    Ports:
        analog-output: Analog Output (priority: 9900)
    Active Port: analog-output
    Formats:
        pcm
    
por Dean Brundage 26.01.2017 / 07:05

0 respostas