mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
pulse-server: init volume/channelmap correctly in stream-restore
This commit is contained in:
parent
edbec5d4ba
commit
0c66b5677b
4 changed files with 20 additions and 11 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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, \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 &&
|
||||
|
|
|
|||
|
|
@ -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, \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue