pulse-server: actually wait for sync to complete

Wait for sync to complete before we start emiting new objects.
Add some more debug
This commit is contained in:
Wim Taymans 2020-11-24 11:27:38 +01:00
parent 7efd140e10
commit cc7f91db19
2 changed files with 16 additions and 4 deletions

View file

@ -68,6 +68,7 @@ struct object {
static void core_sync(struct manager *m)
{
m->sync_seq = pw_core_sync(m->this.core, PW_ID_CORE, m->sync_seq);
pw_log_debug("sync start %u", m->sync_seq);
}
static struct pw_manager_param *add_param(struct spa_list *params, uint32_t id, const struct spa_pod *param)
@ -558,8 +559,12 @@ static void on_core_done(void *data, uint32_t id, int seq)
struct object *o;
if (id == PW_ID_CORE) {
if (m->sync_seq == seq)
manager_emit_sync(m);
if (m->sync_seq != seq)
return;
pw_log_debug("sync end %u/%u", m->sync_seq, seq);
manager_emit_sync(m);
spa_list_for_each(o, &m->this.object_list, this.link) {
if (o->this.creating) {

View file

@ -1149,6 +1149,9 @@ static int reply_create_record_stream(struct stream *stream)
pw_stream_update_properties(stream->stream,
&SPA_DICT_INIT(items, 1));
pw_log_info(NAME" %p: [%s] reply CREATE_RECORD_STREAM tag:%u latency:%s",
stream, client->name, stream->create_tag, latency);
reply = reply_new(client, stream->create_tag);
message_put(reply,
TAG_U32, stream->channel, /* stream index/channel */
@ -3412,8 +3415,10 @@ static int fill_sink_info(struct client *client, struct message *m,
if (!sample_spec_valid(&dev_info.ss) ||
!channel_map_valid(&dev_info.map) ||
!volume_valid(&dev_info.volume_info.volume))
!volume_valid(&dev_info.volume_info.volume)) {
pw_log_warn("%d: not ready", o->id);
return -ENOENT;
}
flags = SINK_LATENCY | SINK_DYNAMIC_LATENCY | SINK_DECIBEL_VOLUME;
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)
@ -3546,8 +3551,10 @@ static int fill_source_info(struct client *client, struct message *m,
if (!sample_spec_valid(&dev_info.ss) ||
!channel_map_valid(&dev_info.map) ||
!volume_valid(&dev_info.volume_info.volume))
!volume_valid(&dev_info.volume_info.volume)) {
pw_log_warn("%d: not ready", o->id);
return -ENOENT;
}
flags = SOURCE_LATENCY | SOURCE_DYNAMIC_LATENCY | SOURCE_DECIBEL_VOLUME;
if ((str = spa_dict_lookup(info->props, PW_KEY_DEVICE_API)) != NULL)