mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: parse default.clock.rate from core info
Use the core.info clock rate as the default sample rate as soon as the manager exposes the core object. Otherwise the default sample rate is 0 until someone calls GET_SERVER_INFO, which as a side effect sets the default sample rate. Fixes issues with sinks not appearing right away. Fixes #1588
This commit is contained in:
parent
535aca1b30
commit
fda6e7b4af
1 changed files with 10 additions and 13 deletions
|
|
@ -683,10 +683,18 @@ static int reply_create_stream(struct stream *stream, struct pw_manager_object *
|
|||
static void manager_added(void *data, struct pw_manager_object *o)
|
||||
{
|
||||
struct client *client = data;
|
||||
struct pw_manager *manager = client->manager;
|
||||
const char *str;
|
||||
|
||||
register_object_message_handlers(o);
|
||||
|
||||
if (strcmp(o->type, PW_TYPE_INTERFACE_Core) == 0 && manager->info != NULL) {
|
||||
struct pw_core_info *info = manager->info;
|
||||
if (info->props &&
|
||||
(str = spa_dict_lookup(info->props, "default.clock.rate")) != NULL)
|
||||
client->impl->defs.sample_spec.rate = atoi(str);
|
||||
}
|
||||
|
||||
if (spa_streq(o->type, PW_TYPE_INTERFACE_Metadata)) {
|
||||
if (o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_METADATA_NAME)) != NULL)
|
||||
|
|
@ -697,7 +705,7 @@ static void manager_added(void *data, struct pw_manager_object *o)
|
|||
struct stream *s;
|
||||
struct pw_manager_object *peer = NULL;
|
||||
spa_list_for_each(s, &client->pending_streams, link) {
|
||||
peer = find_linked(s->client->manager, s->id, s->direction);
|
||||
peer = find_linked(manager, s->id, s->direction);
|
||||
if (peer)
|
||||
break;
|
||||
}
|
||||
|
|
@ -3062,22 +3070,11 @@ static int do_get_server_info(struct client *client, uint32_t command, uint32_t
|
|||
struct pw_manager *manager = client->manager;
|
||||
struct pw_core_info *info = manager->info;
|
||||
char name[256];
|
||||
const char *str;
|
||||
struct message *reply;
|
||||
uint32_t cookie;
|
||||
|
||||
pw_log_info(NAME" %p: [%s] GET_SERVER_INFO tag:%u", impl, client->name, tag);
|
||||
|
||||
|
||||
if (info != NULL) {
|
||||
if (info->props &&
|
||||
(str = spa_dict_lookup(info->props, "default.clock.rate")) != NULL)
|
||||
impl->defs.sample_spec.rate = atoi(str);
|
||||
cookie = info->cookie;
|
||||
} else {
|
||||
cookie = 0;
|
||||
}
|
||||
|
||||
snprintf(name, sizeof(name), "PulseAudio (on PipeWire %s)", pw_get_library_version());
|
||||
|
||||
reply = reply_new(client, tag);
|
||||
|
|
@ -3089,7 +3086,7 @@ static int do_get_server_info(struct client *client, uint32_t command, uint32_t
|
|||
TAG_SAMPLE_SPEC, &impl->defs.sample_spec,
|
||||
TAG_STRING, get_default(client, true), /* default sink name */
|
||||
TAG_STRING, get_default(client, false), /* default source name */
|
||||
TAG_U32, cookie, /* cookie */
|
||||
TAG_U32, info ? info->cookie : 0, /* cookie */
|
||||
TAG_INVALID);
|
||||
|
||||
if (client->version >= 15) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue