[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] pactl: Stop a crash when setting the volume which is out of range
PulseAudio Marge Bot (@pulseaudio-merge-bot)
gitlab at gitlab.freedesktop.org
Tue Dec 6 07:46:31 UTC 2022
PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio
Commits:
e4517da3 by Alistair Leslie-Hughes at 2022-12-06T18:37:33+11:00
pactl: Stop a crash when setting the volume which is out of range
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/758>
- - - - -
1 changed file:
- src/utils/pactl.c
Changes:
=====================================
src/utils/pactl.c
=====================================
@@ -1870,6 +1870,7 @@ static void get_sink_volume_callback(pa_context *c, const pa_sink_info *i, int i
static void set_sink_volume_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata) {
pa_cvolume cv;
+ pa_operation *o;
if (is_last < 0) {
pa_log(_("Failed to get sink information: %s"), pa_strerror(pa_context_errno(c)));
@@ -1885,7 +1886,13 @@ static void set_sink_volume_callback(pa_context *c, const pa_sink_info *i, int i
cv = i->volume;
fill_volume(&cv, i->channel_map.channels);
- pa_operation_unref(pa_context_set_sink_volume_by_name(c, sink_name, &cv, simple_callback, NULL));
+ o = pa_context_set_sink_volume_by_name(c, sink_name, &cv, simple_callback, NULL);
+ if (o)
+ pa_operation_unref(o);
+ else {
+ pa_log(_("Failed to set sink volume: %s"), pa_strerror(pa_context_errno(c)));
+ complete_action();
+ }
}
static void get_source_mute_callback(pa_context *c, const pa_source_info *i, int is_last, void *userdata) {
@@ -1929,6 +1936,7 @@ static void get_source_volume_callback(pa_context *c, const pa_source_info *i, i
static void set_source_volume_callback(pa_context *c, const pa_source_info *i, int is_last, void *userdata) {
pa_cvolume cv;
+ pa_operation *o;
if (is_last < 0) {
pa_log(_("Failed to get source information: %s"), pa_strerror(pa_context_errno(c)));
@@ -1944,7 +1952,13 @@ static void set_source_volume_callback(pa_context *c, const pa_source_info *i, i
cv = i->volume;
fill_volume(&cv, i->channel_map.channels);
- pa_operation_unref(pa_context_set_source_volume_by_name(c, source_name, &cv, simple_callback, NULL));
+ o = pa_context_set_source_volume_by_name(c, source_name, &cv, simple_callback, NULL);
+ if (o)
+ pa_operation_unref(o);
+ else {
+ pa_log(_("Failed to set source volume: %s"), pa_strerror(pa_context_errno(c)));
+ complete_action();
+ }
}
static void get_sink_input_volume_callback(pa_context *c, const pa_sink_input_info *i, int is_last, void *userdata) {
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e4517da353b86a527f443afa112a4773c018d7e9
--
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/e4517da353b86a527f443afa112a4773c018d7e9
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20221206/11f7ca29/attachment-0001.htm>
More information about the pulseaudio-commits
mailing list