AgeCommit message (Collapse)AuthorFilesLines
4 daysAdd port order metadata to JACK sink / source portsHEADmasterChristopher Arndt2-0/+34
Adds JACK metadata property to ports created by *module-jack-sink* and *module-jack-source* with key `JACK_METADATA_ORDER`, the port index (1-based, in order of creation) as value and type ``. This allows JACK applications, which use JACK metadata, to list or display these ports in correct order. See also: Signed-off-by: Christopher Arndt <> Part-of: <>
4 dayswin32: Use DACLs when setting socket permissionsPatrick Gaskin1-0/+31
Part-of: <>
4 dayscli-command: Replace config dir with toplevel for .include on win32Patrick Gaskin1-4/+22
This makes the behaviour match pa_{open,find}_config_file by replacing PA_DEFAULT_CONFIG_DIR with the toplevel. This fixes the hardcoded paths for {default,system}.pa.d introduced in 45abd0b43c7901b375afcba6d9b0e1cca2f349a8 (!361). Part-of: <>
4 daysbluetooth: adjust sync to source with different sample specIgor V. Kovalenko1-1/+4
Part-of: <>
14 daysbuild-sys: meson: Merge system_conf config data from default_confPatrick Gaskin1-3/+1
Part-of: <>
2021-04-20stream-restore: Fix use of uninitialized variableGeorg Chini1-2/+2
The variable card_name in sink_input_preferred_sink_changed_cb and source_output_preferred_source_changed_cb could be used uninitialized, which leads to invalid database entries. This patch fixes the problem. Part-of: <>
2021-04-19build-sys: meson: do not install manpages for disabled partsIgor V. Kovalenko1-2/+12
Part-of: <>
2021-04-19build-sys: meson: allow building client libraries onlyIgor V. Kovalenko9-190/+293
Part-of: <>
2021-04-19parecord: really fix recording OGGMartin Wilck1-0/+3
432a91ed ("fix "Failed to open audio file" for FLAC and OGG)" claimed to fix recording of OGG files with pacat, but it really fixed only FLAC. This patch must be added on top to fix OGG, too. Part-of: <>
2021-04-19loopback: Fix crash bugGeorg Chini1-0/+14
The loopback message may be called after the sink input is already destroyed which causes a crash. Also memory is leaked because the message object is not correctly freed. This patch fixes the problems by adding a "dead" flag to the message structure and freeing the message object on exit. Part-of: <>
2021-04-19alsa-mixer: Allow selected fallback mappings in all profile setsIgor V. Kovalenko1-3/+15
When fallback mapping is selected all subsequent profile sets containing selected mapping are ignored. When there are only e.g. fallback input mappings available, admitted profile set will only contain one profile with selected first input fallback mapping and no outputs, and rest of profiles will only contain outputs and no inputs. When there are only fallback input and output mappings, there will be no profiles admitted at all. Fix this by making sure that selected first fallback input or output mapping is actually allowed to exist in all probed profile sets. Note while this change allows selected fallback mappings to be found in duplex configuraitons, probing fallbacks still can fail if there is more than one input fallback and first one (selected) does not work in duplex configurations. Part-of: <>
2021-04-19parecord: fix "Failed to open audio file" for FLAC and OGGMartin Wilck1-0/+9
This patch fixes the following error: $ pacat --file-format=ogg -r test.ogg Failed to open audio file. $ parecord sep.flac Failed to open audio file. libsndfile errors out if a WAV or OGG file is set to have anything but SF_ENDIAN_FILE: Part-of: <>
2021-04-16bluetooth: disable HSP HS profile by defaultIgor V. Kovalenko4-6/+33
A few headsets have issues if HFP HF profile connection is attempted before HSP HS profile connection is closed. Looks like this could happen because bluez bluetoothd alows to make simultaneous HSP HS and HFP HF peer connections. One of affected headsets is WH-1000XM2 Until we find out how to prevent simultaneous HSP HS and HFP HF connections, when native backend has HFP HF profile enabled (this is the default) do disable HSP HS completely unless user explicitly request it via discovery modarg. Do this by adding module-bluetooth-discover arg enable_native_hsp_hs, default to inverse of enable_native_hfp_hf. Part-of: <>
2021-04-14bluetooth: handle HFP codec list in any orderIgor V. Kovalenko1-4/+14
HFP HF peer can send +BAC= list of codecs in any order and pa only expects "1,2" Fix this by actually parsing codec list elements while looking for "2" (mSBC) Part-of: <>
2021-04-09proplist: tweak documentation for `pa_proplist_get()`Lyndon Brown1-1/+2
to clarify that only mutating proplist calls potentially invalidate results of earlier get requests, thus addressing the confusion found at [1]. [1]: Part-of: <>
2021-04-05bluetooth: mSBC: log lost input audio packets at debug levelIgor V. Kovalenko1-1/+1
Part-of: <>
2021-04-05bluetooth: add modarg to allow disabling mSBC codecIgor V. Kovalenko5-6/+25
Add module-bluetooth-discover argument enable_msbc, default is true (enabled) Part-of: <>
2021-04-05bluetooth: split BT codec from A2DP SEP configuration apiIgor V. Kovalenko12-275/+322
Common API for all bluetooth codecs is now pa_bt_codec. API to negotiate and configure A2DP SEP over Bluez is now pa_a2dp_endpoint_conf. Part-of: <>
2021-04-05bluetooth: set initial packet size to 60Igor V. Kovalenko2-5/+8
Raise initial MTU size to fix frame size when hci can do 60 byte frames. Part-of: <>
2021-04-05bluetooth: add more call indicatorsIgor V. Kovalenko1-1/+3
Part-of: <>
2021-04-05bluetooth: produce silence on mSBC decoding errorIgor V. Kovalenko1-2/+4
We are supposed to conceal packet loss. This is not trivial but we can at least produce silence instead of breaking on mSBC decoding error. Part-of: <>
2021-04-05bluetooth: remember negotiated HFP codec in native backendIgor V. Kovalenko1-7/+33
Part-of: <>
2021-04-05bluetooth: show negotiated HFP codecIgor V. Kovalenko3-18/+53
While codec switching for HFP is not implemented, show current codec via messaging api. Part-of: <>
2021-04-05bluetooth: add mSBC to backend-ofonoIgor V. Kovalenko1-4/+17
Part-of: <>
2021-04-05bluetooth: prepare to redo transport writeout schedulingIgor V. Kovalenko1-56/+93
Bluetooth SCO is synchronous stream, make our writes more uniformly paced. To do this, first separate writing to socket from rendering a frame. Part-of: <>
2021-04-05bluetooth: mSBC: ignore empty encoded frameIgor V. Kovalenko1-2/+10
If input block size is shorter than SBC frame codesize, encoder will return 0. Log this and skip whole input block. Part-of: <>
2021-04-05bluetooth: mSBC: ignore all-zero packetsIgor V. Kovalenko1-0/+16
This is a workaround for hardware/driver which inserts all-zero packets in what otherwise looks like a valid mSBC stream. Part-of: <>
2021-04-05bluetooth: use helper to set multiple transport object attributesIgor V. Kovalenko4-15/+28
For mSBC to work correctly the following must be set correctly - codec object - transport write method - transport setsockopt method Use helper method to set all three simultaneously. Static configuration structure may be cleaner solution. Part-of: <>
2021-04-05bluetooth: apply write MTU detection based on read packet sizeIgor V. Kovalenko4-0/+22
HFP Audio Connection SCO configuration is negotiated symmetrically in both directions, and USB HCI SCO packet framing is also symmetric in both directions. This means that packet size will be the same for reads and writes over HFP SCO socket. HFP profile specification states that valid speech data shall exist on the Synchronous Connection in both directions after the Audio Connection is established. This guarantees that an incoming packet will arrive shortly after SCO connection is established. Use it's size to fix write MTU in case kernel value is wrong. Discussion here Part-of: <>
2021-04-05bluetooth: add wideband audio codec negotiation to HFPJames Bottomley3-5/+72
The HFP protocol supports the ability to negotiate codecs if that is supported by both AG and HF. This patch adds advertising of codec negotiation support and the ability to negotiate a codec change. The only currently supported extra codec (as of HF 1.7.1) is mSBC. mSBC requires that the transmission be done over an eSCO link with Transparent Data. The linux kernel ensures the former, but we have to manually set the socket to transparent data. Signed-off-by: James Bottomley <> Part-of: <>
2021-04-05bluetooth: add support for mSBC codecJames Bottomley5-0/+329
Adding processing support for the mSBC codec is somewhat problematic, because, although it is a SBC codec, the a2dp handling can't simply be reused because the codec is used on an eSCO link with transparent data, meaning the transmission unit has to be 48 bytes (fragmenting the codec packets) and reassembly and boundary detection is required to be done by the implementation. Therefore we have to implement separate render and push routines for msbc that do this fragmentation. Fragmentation is done by emulating circular buffers. The receive (push) buffer is easy, since the mSBC packet size is 60, simply have a buffer of this size in the sbc_info area where the fragments are reassembled. Once we have a full 60 bytes, decode and restart from zero. The send (render) buffer is more problematic, since the transmit must be done from contiguous memory. This means that the buffer must be the lowest common multiple of the transmission unit and the packet size. This value is 240 since 240/48 == 5 and 240/60 == 4. So the buffer pointers are reset at 240 which is a whole number of both rendered packets and eSCO transmission units. Signed-off-by: James Bottomley <> Part-of: <>
2021-04-05bluetooth: add CVSD codec implementationIgor V. Kovalenko9-72/+209
Part-of: <>
2021-04-05bluetooth: unify decoder code pathsIgor V. Kovalenko1-183/+88
Part-of: <>
2021-04-05bluetooth: unify encoder code pathsIgor V. Kovalenko9-172/+319
Part-of: <>
2021-04-05stream-restore: Fix NULL preferred device handlingTanu Kaskinen1-45/+101
When an application sets a device for a newly created stream, we treat that as a temporary setting, and don't save it as the preferred device for future streams. The handling for this was broken, however: if the stream already had a preferred device saved in the stream-restore database, that was unset. This was a regression introduced in bc0e72832057c9d2744d95767dff2a48c83082c2 and 70bbbcdc8440a6a616467a24496f497b225a2cee. These commits tried to detect in subscribe_callback() when the preferred device is cleared, but as a side effect the preferred device started to get cleared from the database also when a stream was created with a device set by the application. There's no way for subscribe_callback() to distinguish the different cases of the preferred device being NULL. This problem is solved by using the PREFERRED_SINK/SOURCE_CHANGED hooks. The hooks are only called when the preferred device really changes. Fixes: Part-of: <>
2021-04-05sink-input, source-output: Add hooks for preferred device changesTanu Kaskinen3-14/+72
The hooks are fired when the preferred device changes. This is useful for module-stream-restore. I added new set_preferred_sink/source() functions for firing the hooks. The functions also log the preferred device changes. There was already pa_sink_input_set_preferred_sink(), but that had a side effect of moving the stream, so I needed a new function. Since it can be confusing when the two similarly named functions should be called, I added a comment for pa_sink_input_set_preferred_sink() that explains the different situations. Part-of: <>
2021-04-03bluetooth: prioritize native backend HFP HF connectionIgor V. Kovalenko1-2/+2
Bluez prepends newly registered profile to a list of supported profiles, and new peer profile connections are attempted in reverse order of profile registration. Currently native backend would register HFP AG profile before HSP AG profile. When peer supports both HFP HF and HSP HS profiles, this registration order causes extra HSP HS connection attempt before native backend would reject it to make sure peer is reconnected with HFP HF profile. Reorder HSP AG profile registration before HFP AG to make sure peer supporting both profiles connects with HFP HF profile first. Part-of: <>
2021-03-27bluetooth: update messaging api referenceIgor V. Kovalenko1-0/+16
Part-of: <>
2021-03-27message-params: clean upIgor V. Kovalenko9-827/+0
Part-of: <>
2021-03-27message-params: use JSON instead of custom formatIgor V. Kovalenko6-69/+93
Part-of: <>
2021-03-27json: add JSON encoderIgor V. Kovalenko5-0/+1135
Part-of: <>
2021-03-27json: improve supported numbersIgor V. Kovalenko3-62/+59
Use 64bit signed integers and fix double value conversion. Part-of: <>
2021-03-26bluetooth: Only use hardware volume callbacks for peer attenuationMarijn Suijten1-42/+102
Setting these callbacks adds the HW_{VOLUME,MUTE}_CTRL flag even when PulseAudio is solely responsible for performing attenuation whilst only keeping the peer posted on changes. For this case the hardware callback is not registered at all but instead a hook is attached to catch PA_CORE_HOOK_{SINK,SOURCE}_VOLUME_CHANGED. Only when the peer performs attenuation (the peer is in HeadSet/HandsFree role) are the callbacks used, without touching PA software volume at all. A future change could potentially use software volume to compensate for the extremely coarse 16 steps of volume control in HSP and HFP, and to allow volume over 100%. Part-of: <>
2021-03-25alsa-sink: Do not increase watermark when requested to rewind 0 bytesGeorg Chini1-0/+3
Since commit cb91d7a1 the watermark is increased when there is nothing to rewind. This is also done in the case when there was actually no rewind requested at all, so the watermark is increased needlessly. This patch fixes the issue by skipping the rewind if none is requested. Part-of: <>
2021-03-23Win32: Use WAVEFORMATEX for multi-channel audio output on Windows.Edward Lee2-23/+88
Part-of: <>
2021-03-23Win32: Fix build issues.Edward Lee3-3/+3
Part-of: <>
2021-03-17bluetooth: Set up hardware gain control if init volume is received lateMarijn Suijten1-10/+88
Originally written for A2DP this rework of that patch enables late-bound hardware volume control on HFP and HSP. As per the specification the headphones (where gain control for both speaker and microphone could happen in hardware on the peer) are supposed to send initial values for these before the SCO connection is created; these `AT+VG[MS]` commands are also used to determine support for it. PA uses this information in `add_{sink,source}` to attach hardware volume callbacks, _if_ it is supported. Otherwise PA performs the attenuation in software. Unfortunately headphones like the WH-1000XM3's connect to A2DP initially and only send `AT+VGS` (microphone hardware gain is not supported) _during_ SCO connection when the user switches to the HFP profile afterwards; the callbacks set up dynamically in `rfcomm_io_callback` are written after the sink and source have been created (`add_{sink,source}`), leaving them without hardware volume callbacks and with software volume when adjusted on the PA side. (The headphones can still send volume updates resulting in abrupt changes if software and peer volume differ. Furthermore the same attenuation is applied twice - once in PA software, once on the peer). To solve this problem we simply check whether the callbacks have been attached whenever the peer sends a volume change, and if not attach the callbacks to the sink/source and reset software volume. Fixes: d510ddc7f ("bluetooth: Perform software attenuation until HF/HS reports gain control") Part-of: <>
2021-03-16bluetooth: accept +VGM/+VGS unsolicited reply with '=' and ':' separatorIgor V. Kovalenko1-2/+2
HFP specs states both '=' and ':' should be accepted as a valid separator for +VGM and +VGS unsolicited result codes. This change is cherry-picked from Rodrigo Araujo's work here: Part-of: <>
2021-03-16bluetooth: Perform software attenuation until HF/HS reports gain controlMarijn Suijten2-15/+42
HF/HS hardware attenuation is optional on HFP: the peer indicates support with the AT+BRSF command, when bit 4 is set. That does not explicitly mandate speaker or microphone gain control; either is dynamically detected as soon as `AT+VG[MS]=` is received. Otherwise software attenuation is performed. It is also optional on HSP but nothing is mentioned about feature detection, assume it is the same as HFP: perform software attenuation until the HF/HS peer sends an `AT+VG[MS]=` command. When PA is a HS/HF (and the peer the AG) we attenuate both channels in software and unconditionally keep the peer up to date with `AT+VGM/AT+VGS` commands. Part-of: <>
2021-03-16bluetooth: Move attenuation decision to shared functionMarijn Suijten4-16/+64
Generalize the distinction between local and peer-attenuated volumes into a function, paving the way for future changes where this needs to be checked in more places and when A2DP Absolute Volume support is added. Part-of: <>