mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez: backend-native: advertise transport state for incoming connections
Incoming connections only happen when the remote end is an AG. Advertising the state allows the device to dynamically create nodes for such connections.
This commit is contained in:
		
							parent
							
								
									9b788b5a66
								
							
						
					
					
						commit
						f9b39191c4
					
				
					 1 changed files with 9 additions and 12 deletions
				
			
		| 
						 | 
					@ -739,7 +739,7 @@ static int sco_acquire_cb(void *data, bool optional)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_debug(backend->log, NAME": transport %p: enter sco_acquire_cb", t);
 | 
						spa_log_debug(backend->log, NAME": transport %p: enter sco_acquire_cb", t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (optional)
 | 
						if (optional || t->fd > 0)
 | 
				
			||||||
		sock = t->fd;
 | 
							sock = t->fd;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		sock = sco_do_connect(t);
 | 
							sock = sco_do_connect(t);
 | 
				
			||||||
| 
						 | 
					@ -787,10 +787,12 @@ static int sco_release_cb(void *data)
 | 
				
			||||||
		t->sco_io = NULL;
 | 
							t->sco_io = NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Shutdown and close the socket */
 | 
						if (t->fd > 0) {
 | 
				
			||||||
	shutdown(t->fd, SHUT_RDWR);
 | 
							/* Shutdown and close the socket */
 | 
				
			||||||
	close(t->fd);
 | 
							shutdown(t->fd, SHUT_RDWR);
 | 
				
			||||||
	t->fd = -1;
 | 
							close(t->fd);
 | 
				
			||||||
 | 
							t->fd = -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -808,6 +810,7 @@ static void sco_event(struct spa_source *source)
 | 
				
			||||||
			shutdown(t->fd, SHUT_RDWR);
 | 
								shutdown(t->fd, SHUT_RDWR);
 | 
				
			||||||
			close (t->fd);
 | 
								close (t->fd);
 | 
				
			||||||
			t->fd = -1;
 | 
								t->fd = -1;
 | 
				
			||||||
 | 
								spa_bt_transport_set_state(t, SPA_BT_TRANSPORT_STATE_IDLE);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -914,13 +917,7 @@ static void sco_listen_event(struct spa_source *source)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_debug(backend->log, NAME": transport %p: audio connected", t);
 | 
						spa_log_debug(backend->log, NAME": transport %p: audio connected", t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
						spa_bt_transport_set_state(t, SPA_BT_TRANSPORT_STATE_PENDING);
 | 
				
			||||||
	if (t->state != PA_BLUETOOTH_TRANSPORT_STATE_PLAYING) {
 | 
					 | 
				
			||||||
		spa_log_info(monitor->log, NAME": SCO incoming connection: changing state to PLAYING");
 | 
					 | 
				
			||||||
		pa_bluetooth_transport_set_state (t, PA_BLUETOOTH_TRANSPORT_STATE_PLAYING);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fail:
 | 
					fail:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue