[PATCH 04/21] alsa: Ensure that sinks and sources have descriptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/19/2013 05:40 PM, Tanu Kaskinen wrote:
> I have never seen the description missing, but from reading the code
> it seems that in some cases the description might be missing.

I don't like duplicating information, so how about implementing this 
fallback logic in pa_sink_get_description() instead?

> ---
>   src/modules/alsa/alsa-sink.c   | 3 +++
>   src/modules/alsa/alsa-source.c | 3 +++
>   2 files changed, 6 insertions(+)
>
> diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
> index 0f82df6..7c8db2e 100644
> --- a/src/modules/alsa/alsa-sink.c
> +++ b/src/modules/alsa/alsa-sink.c
> @@ -2307,6 +2307,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
>           goto fail;
>       }
>
> +    if (!pa_proplist_contains(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))
> +        pa_proplist_sets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION, u->sink->name);
> +
>       if (pa_modargs_get_value_u32(ma, "deferred_volume_safety_margin",
>                                    &u->sink->thread_info.volume_change_safety_margin) < 0) {
>           pa_log("Failed to parse deferred_volume_safety_margin parameter");
> diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
> index 15b6aeb..6541c91 100644
> --- a/src/modules/alsa/alsa-source.c
> +++ b/src/modules/alsa/alsa-source.c
> @@ -2004,6 +2004,9 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
>           goto fail;
>       }
>
> +    if (!pa_proplist_contains(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION))
> +        pa_proplist_sets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION, u->source->name);
> +
>       if (pa_modargs_get_value_u32(ma, "deferred_volume_safety_margin",
>                                    &u->source->thread_info.volume_change_safety_margin) < 0) {
>           pa_log("Failed to parse deferred_volume_safety_margin parameter");
>



-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux