mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
bluez5: add port latency reporting
This commit is contained in:
parent
d8435cd5fd
commit
38bcec9022
6 changed files with 120 additions and 5 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include <spa/node/io.h>
|
||||
#include <spa/node/keys.h>
|
||||
#include <spa/param/param.h>
|
||||
#include <spa/param/latency-utils.h>
|
||||
#include <spa/param/audio/format.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
|
@ -75,12 +76,14 @@ struct port {
|
|||
struct spa_port_info info;
|
||||
struct spa_io_buffers *io;
|
||||
struct spa_io_rate_match *rate_match;
|
||||
struct spa_latency_info latency;
|
||||
#define IDX_EnumFormat 0
|
||||
#define IDX_Meta 1
|
||||
#define IDX_IO 2
|
||||
#define IDX_Format 3
|
||||
#define IDX_Buffers 4
|
||||
#define N_PORT_PARAMS 5
|
||||
#define IDX_Latency 5
|
||||
#define N_PORT_PARAMS 6
|
||||
struct spa_param_info params[N_PORT_PARAMS];
|
||||
|
||||
struct buffer buffers[MAX_BUFFERS];
|
||||
|
|
@ -896,6 +899,16 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
}
|
||||
break;
|
||||
|
||||
case SPA_PARAM_Latency:
|
||||
switch (result.index) {
|
||||
case 0:
|
||||
param = spa_latency_build(&b, id, &port->latency);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENOENT;
|
||||
}
|
||||
|
|
@ -957,6 +970,7 @@ static int port_set_format(struct impl *this, struct port *port,
|
|||
port->info.rate = SPA_FRACTION(1, port->current_format.info.raw.rate);
|
||||
port->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_READWRITE);
|
||||
port->params[IDX_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, SPA_PARAM_INFO_READ);
|
||||
port->params[IDX_Latency].flags ^= SPA_PARAM_INFO_SERIAL;
|
||||
} else {
|
||||
port->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
|
||||
port->params[IDX_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
|
||||
|
|
@ -1237,8 +1251,14 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
port->params[IDX_IO] = SPA_PARAM_INFO(SPA_PARAM_IO, SPA_PARAM_INFO_READ);
|
||||
port->params[IDX_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
|
||||
port->params[IDX_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
|
||||
port->params[IDX_Latency] = SPA_PARAM_INFO(SPA_PARAM_Latency, SPA_PARAM_INFO_READWRITE);
|
||||
port->info.params = port->params;
|
||||
port->info.n_params = N_PORT_PARAMS;
|
||||
|
||||
port->latency = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
|
||||
port->latency.min_quantum = 1.0f;
|
||||
port->latency.max_quantum = 1.0f;
|
||||
|
||||
spa_list_init(&port->ready);
|
||||
|
||||
if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue