mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
bluez5: refcount transport acquire and release, let it manage fd
Backends don't necessarily allow for opening the same device multiple times, and it shouldn't be necessary. Since source and sink are not necessarily both running at the same time, refcount the transport acquire/release so that it knows to close the fd only when no source/sink is running. Let the transport manage the fd lifecycle, also closing it once it is not needed. Don't return the fd from acquire(), since each transport is associated with a single socket fd.
This commit is contained in:
parent
8942f6b402
commit
036c10717d
7 changed files with 85 additions and 51 deletions
|
|
@ -232,7 +232,7 @@ static int ofono_audio_acquire(void *data, bool optional)
|
|||
transport->path, transport->fd, transport->codec);
|
||||
|
||||
ofono_transport_get_mtu(backend, transport);
|
||||
ret = transport->fd;
|
||||
ret = 0;
|
||||
|
||||
finish:
|
||||
return ret;
|
||||
|
|
@ -243,11 +243,6 @@ static int ofono_audio_release(void *data)
|
|||
struct spa_bt_transport *transport = data;
|
||||
struct spa_bt_backend *backend = transport->backend;
|
||||
|
||||
if (transport->fd < 0) {
|
||||
spa_log_info(backend->log, NAME": transport %s already released", transport->path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
spa_log_debug(backend->log, NAME": transport %p: Release %s",
|
||||
transport, transport->path);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue