mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
volume: Fix incorrect usage of PA_VOLUME_IS_VALID
The commit that introduced this macro was incorrect in some places. This patch fixes these. Thanks to Pierre-Louis Bossart for pointing this out.
This commit is contained in:
parent
340729d66f
commit
9b8f20f617
4 changed files with 6 additions and 6 deletions
|
|
@ -366,7 +366,7 @@ static void handle_play(DBusConnection *conn, DBusMessage *msg, void *userdata)
|
|||
if (!(property_list = pa_dbus_get_proplist_arg(conn, msg, &msg_iter)))
|
||||
return;
|
||||
|
||||
if (PA_VOLUME_IS_VALID(volume)) {
|
||||
if (!PA_VOLUME_IS_VALID(volume)) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Invalid volume.");
|
||||
goto finish;
|
||||
}
|
||||
|
|
@ -416,7 +416,7 @@ static void handle_play_to_sink(DBusConnection *conn, DBusMessage *msg, void *us
|
|||
goto finish;
|
||||
}
|
||||
|
||||
if (PA_VOLUME_IS_VALID(volume)) {
|
||||
if (!PA_VOLUME_IS_VALID(volume)) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Invalid volume.");
|
||||
goto finish;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag
|
|||
}
|
||||
|
||||
for (i = 0; i < n_volume_entries; ++i) {
|
||||
if (PA_VOLUME_IS_VALID(volume[i])) {
|
||||
if (!PA_VOLUME_IS_VALID(volume[i])) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Too large volume value: %u", volume[i]);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ static int get_volume_arg(DBusConnection *conn, DBusMessage *msg, DBusMessageIte
|
|||
pa_assert_se(dbus_message_iter_next(&struct_iter));
|
||||
dbus_message_iter_get_basic(&struct_iter, &chan_vol);
|
||||
|
||||
if (PA_VOLUME_IS_VALID(chan_vol)) {
|
||||
if (!PA_VOLUME_IS_VALID(chan_vol)) {
|
||||
pa_dbus_send_error(conn, msg, DBUS_ERROR_INVALID_ARGS, "Invalid volume: %u", chan_vol);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -336,12 +336,12 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
|
|||
|
||||
pass_volume = TRUE;
|
||||
|
||||
if (e->volume_is_set && !PA_VOLUME_IS_VALID(volume)) {
|
||||
if (e->volume_is_set && PA_VOLUME_IS_VALID(volume)) {
|
||||
pa_cvolume_set(&r, e->sample_spec.channels, volume);
|
||||
pa_sw_cvolume_multiply(&r, &r, &e->volume);
|
||||
} else if (e->volume_is_set)
|
||||
r = e->volume;
|
||||
else if (!PA_VOLUME_IS_VALID(volume))
|
||||
else if (PA_VOLUME_IS_VALID(volume))
|
||||
pa_cvolume_set(&r, e->sample_spec.channels, volume);
|
||||
else
|
||||
pass_volume = FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue