- 06 Apr, 2021 8 commits
-
-
Marijn Suijten authored
-
Marijn Suijten authored
-
Marijn Suijten authored
-
Marijn Suijten authored
This unfortunately requires us to manually (un)cork inputs/outputs so that _update_resampler is called on them. It is anyway fine to cork these as their sink/source is temporarily idle to perform a codec switch.
-
Marijn Suijten authored
The main source of routing audio to another sink on codec switch is the PA sink disappearing, together with its IO thread and other primitives. This is annoying for users but also wasteful; all we need to do for a codec switch is make the sink temporarily unavailable, release the transport, perform the usual `SetConfiguration` on another `SEP` and `Acquire` the resulting stream that is made available, to finally reconfigure the sink with the new sampling rate and format and make the sink available again.
-
Marijn Suijten authored
Prevent a pointer to freed memory from lingering around.
-
Marijn Suijten authored
This is not always the default; rather what is requested based on application.
-
Marijn Suijten authored
The desired list of capabilities is provided by the caller; if an endpoint is successfully selected that endpoint resides in this hashmap. Perhaps choose_remote_endpoint should return the key-value pair instead?
-
- 05 Apr, 2021 21 commits
-
-
Igor Kovalenko authored
Part-of: <!507>
-
Igor Kovalenko authored
Add module-bluetooth-discover argument enable_msbc, default is true (enabled) Part-of: <!507>
-
Igor Kovalenko authored
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: <!507>
-
Igor Kovalenko authored
Raise initial MTU size to fix frame size when hci can do 60 byte frames. Part-of: <!507>
-
Igor Kovalenko authored
Part-of: <!507>
-
Igor Kovalenko authored
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: <!507>
-
Igor Kovalenko authored
Part-of: <!507>
-
Igor Kovalenko authored
While codec switching for HFP is not implemented, show current codec via messaging api. Part-of: <!507>
-
Igor Kovalenko authored
Part-of: <!507>
-
Igor Kovalenko authored
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: <!507>
-
Igor Kovalenko authored
If input block size is shorter than SBC frame codesize, encoder will return 0. Log this and skip whole input block. Part-of: <!507>
-
Igor Kovalenko authored
This is a workaround for hardware/driver which inserts all-zero packets in what otherwise looks like a valid mSBC stream. Part-of: <!507>
-
Igor Kovalenko authored
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: <!507>
-
Igor Kovalenko authored
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 https://lore.kernel.org/patchwork/patch/1303411/ Part-of: <!507>
-
James Bottomley authored
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 <James.Bottomley@HansenPartnership.com> Part-of: <!507>
-
James Bottomley authored
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 <James.Bottomley@HansenPartnership.com> Part-of: <!507>
-
Igor Kovalenko authored
Part-of: <!507>
-
Igor Kovalenko authored
Part-of: <!507>
-
Igor Kovalenko authored
Part-of: <!507>
-
Tanu Kaskinen authored
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 bc0e7283 and 70bbbcdc. 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: #1063 Part-of: <!535>
-
Tanu Kaskinen authored
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: <!535>
-
- 03 Apr, 2021 1 commit
-
-
Igor Kovalenko authored
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: <!534>
-
- 27 Mar, 2021 5 commits
-
-
Igor Kovalenko authored
Part-of: <!525>
-
Igor Kovalenko authored
Part-of: <!525>
-
Igor Kovalenko authored
Part-of: <!525>
-
Igor Kovalenko authored
Part-of: <!525>
-
Igor Kovalenko authored
Use 64bit signed integers and fix double value conversion. Part-of: <!525>
-
- 26 Mar, 2021 1 commit
-
-
Marijn Suijten authored
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: <!519>
-
- 25 Mar, 2021 1 commit
-
-
Georg Chini authored
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: <!530>
-
- 23 Mar, 2021 2 commits
-
-
Edward Lee authored
Part-of: <!359>
-
Edward Lee authored
Part-of: <!359>
-
- 17 Mar, 2021 1 commit
-
-
Marijn Suijten authored
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: d510ddc7 ("bluetooth: Perform software attenuation until HF/HS reports gain control") Part-of: <pulseaudio/pulseaudio!528>
-