mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Support A2DP codec switching via messaging API
This uses the messaging API to initiate a codec switch.
While a particular codec might be applicable only for a particular
profile, for eg. aptX can only be applicable for A2DP sink or source
and not for let's say HSP, the codec switching logic has not been
tied to the logic for switching profiles.
Codec can be switched by running the following on the command line.
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec{"ldac_hq"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"ldac_mq"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"ldac_sq"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"aptx_hd"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"aptx"}
pacmd send-message /card/bluez_card.XX_XX_XX_XX_XX_XX/bluez switch-codec {"sbc"}
Codec name passed above is matched against pa_a2dp_codec->name. Note that
the match is case sensitive. XX_XX_XX_XX_XX_XX needs to be substituted with
the actual bluetooth device id.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/440>
			
			
This commit is contained in:
		
							parent
							
								
									5284b450e7
								
							
						
					
					
						commit
						3447335da9
					
				
					 4 changed files with 500 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -62,7 +62,9 @@ static pa_hook_result_t device_connection_changed_cb(pa_bluetooth_discovery *y,
 | 
			
		|||
 | 
			
		||||
    module_loaded = pa_hashmap_get(u->loaded_device_paths, d->path) ? true : false;
 | 
			
		||||
 | 
			
		||||
    if (module_loaded && !pa_bluetooth_device_any_transport_connected(d)) {
 | 
			
		||||
    /* When changing A2DP codec there is no transport connected, ensure that no module is unloaded */
 | 
			
		||||
    if (module_loaded && !pa_bluetooth_device_any_transport_connected(d) &&
 | 
			
		||||
            !d->codec_switching_in_progress) {
 | 
			
		||||
        /* disconnection, the module unloads itself */
 | 
			
		||||
        pa_log_debug("Unregistering module for %s", d->path);
 | 
			
		||||
        pa_hashmap_remove(u->loaded_device_paths, d->path);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue