mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
sink, source: Disallow NULL or empty description
This commit is contained in:
parent
3f2eb1e09f
commit
8d00e420f7
2 changed files with 13 additions and 21 deletions
|
|
@ -2299,29 +2299,25 @@ bool pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p)
|
|||
}
|
||||
|
||||
/* Called from main thread */
|
||||
/* FIXME -- this should be dropped and be merged into pa_sink_update_proplist() */
|
||||
void pa_sink_set_description(pa_sink *s, const char *description) {
|
||||
const char *old;
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert_ctl_context();
|
||||
|
||||
if (!description && !pa_proplist_contains(s->proplist, PA_PROP_DEVICE_DESCRIPTION))
|
||||
return;
|
||||
pa_sink_assert_ref(s);
|
||||
pa_assert(description);
|
||||
pa_assert(*description);
|
||||
pa_assert_ctl_context();
|
||||
|
||||
old = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
|
||||
if (old && description && pa_streq(old, description))
|
||||
if (old && pa_streq(old, description))
|
||||
return;
|
||||
|
||||
if (description)
|
||||
pa_proplist_sets(s->proplist, PA_PROP_DEVICE_DESCRIPTION, description);
|
||||
else
|
||||
pa_proplist_unset(s->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_sets(s->proplist, PA_PROP_DEVICE_DESCRIPTION, description);
|
||||
|
||||
if (s->monitor_source) {
|
||||
char *n;
|
||||
|
||||
n = pa_sprintf_malloc("Monitor Source of %s", description ? description : s->name);
|
||||
n = pa_sprintf_malloc("Monitor Source of %s", description);
|
||||
pa_source_set_description(s->monitor_source, n);
|
||||
pa_xfree(n);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1893,24 +1893,20 @@ bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist
|
|||
}
|
||||
|
||||
/* Called from main thread */
|
||||
/* FIXME -- this should be dropped and be merged into pa_source_update_proplist() */
|
||||
void pa_source_set_description(pa_source *s, const char *description) {
|
||||
const char *old;
|
||||
pa_source_assert_ref(s);
|
||||
pa_assert_ctl_context();
|
||||
|
||||
if (!description && !pa_proplist_contains(s->proplist, PA_PROP_DEVICE_DESCRIPTION))
|
||||
return;
|
||||
pa_source_assert_ref(s);
|
||||
pa_assert(description);
|
||||
pa_assert(*description);
|
||||
pa_assert_ctl_context();
|
||||
|
||||
old = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
|
||||
if (old && description && pa_streq(old, description))
|
||||
if (old && pa_streq(old, description))
|
||||
return;
|
||||
|
||||
if (description)
|
||||
pa_proplist_sets(s->proplist, PA_PROP_DEVICE_DESCRIPTION, description);
|
||||
else
|
||||
pa_proplist_unset(s->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
pa_proplist_sets(s->proplist, PA_PROP_DEVICE_DESCRIPTION, description);
|
||||
|
||||
if (PA_SOURCE_IS_LINKED(s->state)) {
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue