mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Fix bluetooth.nrec property not updated
PropertyChanged signal of org.BlueZ.MediaTransport is processed in pa_bluetooth_transport_parse_property() which updates t->nrec. This is called by : - First by filter_cb() of bluetooth-util.c - Then by filter_cb() of module-bluetooth-device.c which retrieve value of t->nrec before calling parse function, then it checks if t->nrec has changed before updating bluetooth.nrec property. As t->nrec has alreday been changed during first process, property update is never performed. This patch creates a new hook in pa_bluetooth_transport called PA_BLUETOOTH_TRANSPORT_HOOK_NREC_CHANGED. The hook is fired by bluetooth-util.c when the transport's NREC property changes. module-bluetooth-device.c won't listen the PropertyChanged signal of MediaTransport anymore. Instead, it will use the hook in pa_bluetooth_transport to get a notification when the NREC property changes, and update the sink or source proplist accordingly. const qualifier for returned pointer of pa_bluetooth_discovery_get_transport() is removed.
This commit is contained in:
		
							parent
							
								
									a91359956f
								
							
						
					
					
						commit
						017e1c4dda
					
				
					 3 changed files with 47 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -138,8 +138,13 @@ static pa_bluetooth_device* device_new(const char *path) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static void transport_free(pa_bluetooth_transport *t) {
 | 
			
		||||
    unsigned i;
 | 
			
		||||
 | 
			
		||||
    pa_assert(t);
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < PA_BLUETOOTH_TRANSPORT_HOOK_MAX; i++)
 | 
			
		||||
        pa_hook_done(&t->hooks[i]);
 | 
			
		||||
 | 
			
		||||
    pa_xfree(t->path);
 | 
			
		||||
    pa_xfree(t->config);
 | 
			
		||||
    pa_xfree(t);
 | 
			
		||||
| 
						 | 
				
			
			@ -756,8 +761,11 @@ int pa_bluetooth_transport_parse_property(pa_bluetooth_transport *t, DBusMessage
 | 
			
		|||
            dbus_bool_t value;
 | 
			
		||||
            dbus_message_iter_get_basic(&variant_i, &value);
 | 
			
		||||
 | 
			
		||||
            if (pa_streq(key, "NREC"))
 | 
			
		||||
            if (pa_streq(key, "NREC") && t->nrec != value) {
 | 
			
		||||
                t->nrec = value;
 | 
			
		||||
                pa_log_debug("Transport %s: Property 'NREC' changed to %s.", t->path, t->nrec ? "True" : "False");
 | 
			
		||||
                pa_hook_fire(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_NREC_CHANGED], NULL);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            break;
 | 
			
		||||
         }
 | 
			
		||||
| 
						 | 
				
			
			@ -979,7 +987,7 @@ const pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_disco
 | 
			
		|||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const pa_bluetooth_transport* pa_bluetooth_discovery_get_transport(pa_bluetooth_discovery *y, const char *path) {
 | 
			
		||||
pa_bluetooth_transport* pa_bluetooth_discovery_get_transport(pa_bluetooth_discovery *y, const char *path) {
 | 
			
		||||
    pa_bluetooth_device *d;
 | 
			
		||||
    pa_bluetooth_transport *t;
 | 
			
		||||
    void *state = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -1085,6 +1093,7 @@ static int setup_dbus(pa_bluetooth_discovery *y) {
 | 
			
		|||
 | 
			
		||||
static pa_bluetooth_transport *transport_new(pa_bluetooth_discovery *y, const char *path, enum profile p, const uint8_t *config, int size) {
 | 
			
		||||
    pa_bluetooth_transport *t;
 | 
			
		||||
    unsigned i;
 | 
			
		||||
 | 
			
		||||
    t = pa_xnew0(pa_bluetooth_transport, 1);
 | 
			
		||||
    t->y = y;
 | 
			
		||||
| 
						 | 
				
			
			@ -1097,6 +1106,9 @@ static pa_bluetooth_transport *transport_new(pa_bluetooth_discovery *y, const ch
 | 
			
		|||
        memcpy(t->config, config, size);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < PA_BLUETOOTH_TRANSPORT_HOOK_MAX; i++)
 | 
			
		||||
        pa_hook_init(&t->hooks[i], t);
 | 
			
		||||
 | 
			
		||||
    return t;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue