mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Ignore Device.DisconnectRequested
Handling the signal DisconnectRequested should be unnecessary since the
profile-specific interfaces will be later disconnected, leading to
module unload.
Additionally, the signal is problematic: if an interface (i.e.
A2DP AudioSource) is playing at the time DisconnectRequested is
signaled, the following sequence can occur:
1. AudioSource is playing
2. DisconnectRequested is received
3. Module is unloaded due to DisconnectRequested
4. AudioSource state changes from playing to connected
5. module-bluetooth-discover loads the module
6. AudioSource state changes from connected to disconnected
Therefore the module is unnecessarily loaded, to be unloaded immediately
afterwards. This can easily be reproduced if a device is unpaired while
the audio is streaming.
The simplest solution to this consists of removing step 3, by just
ignoring the DisconnectRequested signal. This reverts commit
8169a6a6c9.
			
			
This commit is contained in:
		
							parent
							
								
									f0432ce6ae
								
							
						
					
					
						commit
						67c0090556
					
				
					 1 changed files with 0 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -862,22 +862,6 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 | 
			
		|||
 | 
			
		||||
        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 | 
			
		||||
 | 
			
		||||
    } else if (dbus_message_is_signal(m, "org.bluez.Device", "DisconnectRequested")) {
 | 
			
		||||
        pa_bluetooth_device *d;
 | 
			
		||||
 | 
			
		||||
        if ((d = pa_hashmap_get(y->devices, dbus_message_get_path(m)))) {
 | 
			
		||||
            /* Device will disconnect in 2 sec */
 | 
			
		||||
            d->audio_state = PA_BT_AUDIO_STATE_DISCONNECTED;
 | 
			
		||||
            d->audio_sink_state = PA_BT_AUDIO_STATE_DISCONNECTED;
 | 
			
		||||
            d->audio_source_state = PA_BT_AUDIO_STATE_DISCONNECTED;
 | 
			
		||||
            d->headset_state = PA_BT_AUDIO_STATE_DISCONNECTED;
 | 
			
		||||
            d->hfgw_state = PA_BT_AUDIO_STATE_DISCONNECTED;
 | 
			
		||||
 | 
			
		||||
            run_callback(y, d, FALSE);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 | 
			
		||||
 | 
			
		||||
    } else if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) {
 | 
			
		||||
        const char *name, *old_owner, *new_owner;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1471,7 +1455,6 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
 | 
			
		|||
                "type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
 | 
			
		||||
                "type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceCreated'",
 | 
			
		||||
                "type='signal',sender='org.bluez',interface='org.bluez.Device',member='PropertyChanged'",
 | 
			
		||||
                "type='signal',sender='org.bluez',interface='org.bluez.Device',member='DisconnectRequested'",
 | 
			
		||||
                "type='signal',sender='org.bluez',interface='org.bluez.Audio',member='PropertyChanged'",
 | 
			
		||||
                "type='signal',sender='org.bluez',interface='org.bluez.Headset',member='PropertyChanged'",
 | 
			
		||||
                "type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'",
 | 
			
		||||
| 
						 | 
				
			
			@ -1537,7 +1520,6 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
 | 
			
		|||
                               "type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceRemoved'",
 | 
			
		||||
                               "type='signal',sender='org.bluez',interface='org.bluez.Adapter',member='DeviceCreated'",
 | 
			
		||||
                               "type='signal',sender='org.bluez',interface='org.bluez.Device',member='PropertyChanged'",
 | 
			
		||||
                               "type='signal',sender='org.bluez',interface='org.bluez.Device',member='DisconnectRequested'",
 | 
			
		||||
                               "type='signal',sender='org.bluez',interface='org.bluez.Audio',member='PropertyChanged'",
 | 
			
		||||
                               "type='signal',sender='org.bluez',interface='org.bluez.Headset',member='PropertyChanged'",
 | 
			
		||||
                               "type='signal',sender='org.bluez',interface='org.bluez.AudioSink',member='PropertyChanged'",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue