diff --git a/src/modules/module-protocol-pulse/ext-stream-restore.c b/src/modules/module-protocol-pulse/ext-stream-restore.c index 06920e8cb..0da17b02c 100644 --- a/src/modules/module-protocol-pulse/ext-stream-restore.c +++ b/src/modules/module-protocol-pulse/ext-stream-restore.c @@ -115,21 +115,19 @@ static int key_to_name(const char *key, char *name, size_t maxlen) static int do_extension_stream_restore_read(struct client *client, uint32_t command, uint32_t tag, struct message *m) { struct message *reply; - struct volume vol = VOLUME_INIT; - struct channel_map map; - float volume; - char device_name[1024] = "\0"; const struct spa_dict_item *item; - spa_zero(map); - reply = reply_new(client, tag); spa_dict_for_each(item, &client->routes->dict) { struct spa_json it[3]; const char *value; char name[1024]; + char device_name[1024] = "\0"; bool mute = false; + struct volume vol = VOLUME_INIT; + struct channel_map map = CHANNEL_MAP_INIT; + float volume = 0.0f; int len; if (key_to_name(item->key, name, sizeof(name)) < 0) @@ -178,7 +176,6 @@ static int do_extension_stream_restore_read(struct client *client, uint32_t comm else if (spa_json_next(&it[1], &value) <= 0) break; } - map.channels = vol.channels; message_put(reply, TAG_STRING, name, TAG_CHANNEL_MAP, &map, diff --git a/src/modules/module-protocol-pulse/format.c b/src/modules/module-protocol-pulse/format.c index 9134385cb..56ccf6b1c 100644 --- a/src/modules/module-protocol-pulse/format.c +++ b/src/modules/module-protocol-pulse/format.c @@ -107,7 +107,12 @@ struct sample_spec { uint32_t rate; uint8_t channels; }; -#define SAMPLE_SPEC_INIT (struct sample_spec) { \ +#define SAMPLE_SPEC_INIT (struct sample_spec) { \ + .format = SPA_AUDIO_FORMAT_UNKNOWN, \ + .rate = 0, \ + .channels = 0, \ + } +#define SAMPLE_SPEC_DEFAULT (struct sample_spec) { \ .format = SPA_AUDIO_FORMAT_F32, \ .rate = 44100, \ .channels = 2, \ @@ -279,7 +284,10 @@ struct channel_map { }; #define CHANNEL_MAP_INIT (struct channel_map) { \ - .channels = 2, \ + .channels = 0, \ + } +#define CHANNEL_MAP_DEFAULT (struct channel_map) { \ + .channels = 2, \ .map[0] = SPA_AUDIO_CHANNEL_FL, \ .map[1] = SPA_AUDIO_CHANNEL_FR, \ } diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index a6cb9d7c7..33e346a30 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -3101,8 +3101,8 @@ static int do_get_server_info(struct client *client, uint32_t command, uint32_t pw_log_info(NAME" %p: [%s] GET_SERVER_INFO tag:%u", impl, client->name, tag); - ss = SAMPLE_SPEC_INIT; - map = CHANNEL_MAP_INIT; + ss = SAMPLE_SPEC_DEFAULT; + map = CHANNEL_MAP_DEFAULT; if (info != NULL) { if (info->props && diff --git a/src/modules/module-protocol-pulse/volume.c b/src/modules/module-protocol-pulse/volume.c index faaadbe6f..261e111d5 100644 --- a/src/modules/module-protocol-pulse/volume.c +++ b/src/modules/module-protocol-pulse/volume.c @@ -28,6 +28,10 @@ struct volume { }; #define VOLUME_INIT (struct volume) { \ + .channels = 0, \ + } + +#define VOLUME_DEFAULT (struct volume) { \ .channels = 2, \ .values[0] = 1.0f, \ .values[1] = 1.0f, \