Pipewireパッケージ(ちょっと変更)
Revisión | 2804a8f1f6af2d28796005fbd2a952e524bb24ab (tree) |
---|---|
Tiempo | 2023-09-14 00:51:50 |
Autor | Pauli Virtanen <pav@iki....> |
Commiter | P V |
bluez5: minor BAP broadcast fixups
Don't try to deref NULL if adapter not found. Disable bcast reconnect in
simpler way. Use adapter name as device name. Style fixes.
@@ -2382,10 +2382,17 @@ static struct spa_bt_remote_endpoint *remote_endpoint_find(struct spa_bt_monitor | ||
2382 | 2382 | return NULL; |
2383 | 2383 | } |
2384 | 2384 | |
2385 | -static struct spa_bt_device* create_bcast_device(struct spa_bt_monitor *monitor, | |
2386 | - const char *object_path) | |
2385 | +static struct spa_bt_device *create_bcast_device(struct spa_bt_monitor *monitor, const char *object_path) | |
2387 | 2386 | { |
2388 | 2387 | struct spa_bt_device *d; |
2388 | + struct spa_bt_adapter *adapter; | |
2389 | + | |
2390 | + adapter = adapter_find(monitor, object_path); | |
2391 | + if (adapter == NULL) { | |
2392 | + spa_log_warn(monitor->log, "unknown adapter %s", object_path); | |
2393 | + return NULL; | |
2394 | + } | |
2395 | + | |
2389 | 2396 | d = device_create(monitor, object_path); |
2390 | 2397 | if (d == NULL) { |
2391 | 2398 | spa_log_warn(monitor->log, "can't create Bluetooth device %s: %m", |
@@ -2393,22 +2400,12 @@ static struct spa_bt_device* create_bcast_device(struct spa_bt_monitor *monitor, | ||
2393 | 2400 | return NULL; |
2394 | 2401 | } |
2395 | 2402 | |
2396 | - d->adapter = adapter_find(monitor, object_path); | |
2397 | - if (d->adapter == NULL) { | |
2398 | - spa_log_warn(monitor->log, "unknown adapter %s", d->adapter_path); | |
2399 | - } | |
2400 | - d->adapter_path = d->adapter->path; | |
2401 | - d->alias = strdup("bcast_device"); | |
2402 | - d->name = strdup("bcast_device"); | |
2403 | + d->adapter = adapter; | |
2404 | + d->adapter_path = strdup(adapter->path); | |
2405 | + d->alias = strdup(adapter->alias); | |
2406 | + d->name = strdup(adapter->name); | |
2403 | 2407 | d->address = strdup("00:00:00:00:00:00"); |
2404 | - | |
2405 | - spa_bt_device_check_profiles(d, false); | |
2406 | - d->reconnect_state = BT_DEVICE_RECONNECT_INIT; | |
2407 | - | |
2408 | - if (!device_props_ready(d)) | |
2409 | - { | |
2410 | - return NULL; | |
2411 | - } | |
2408 | + d->reconnect_state = BT_DEVICE_RECONNECT_STOP; | |
2412 | 2409 | |
2413 | 2410 | device_update_hw_volume_profiles(d); |
2414 | 2411 |
@@ -2448,6 +2445,7 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en | ||
2448 | 2445 | } |
2449 | 2446 | else if (spa_streq(key, "Device")) { |
2450 | 2447 | struct spa_bt_device *device; |
2448 | + | |
2451 | 2449 | device = spa_bt_device_find(monitor, value); |
2452 | 2450 | if (device == NULL) { |
2453 | 2451 | /* |
@@ -2456,11 +2454,11 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en | ||
2456 | 2454 | * This is done because BlueZ sets the adapter as the device |
2457 | 2455 | * that is connected to for a broadcast sink endpoint/transport. |
2458 | 2456 | */ |
2459 | - if(spa_streq(remote_endpoint->uuid, SPA_BT_UUID_BAP_BROADCAST_SINK)) { | |
2457 | + if (spa_streq(remote_endpoint->uuid, SPA_BT_UUID_BAP_BROADCAST_SINK)) { | |
2460 | 2458 | device = create_bcast_device(monitor, value); |
2461 | - if(device == NULL) { | |
2459 | + if (device == NULL) | |
2462 | 2460 | goto next; |
2463 | - } | |
2461 | + | |
2464 | 2462 | remote_endpoint->acceptor = true; |
2465 | 2463 | device_set_connected(device, 1); |
2466 | 2464 | } else { |