mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
acp: Trim trailing whitespace in monitor name from HDMI ELD
The ELD ends with a \n and spaces to pad the length, but most drivers except NVidia trim that out while presenting to userspace. While this is being tracked upstream [1], let's deal with this locally. [1] https://github.com/NVIDIA/open-gpu-kernel-modules/pull/715 Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4332
This commit is contained in:
parent
8cca14005b
commit
0cc6ac2769
1 changed files with 10 additions and 1 deletions
|
|
@ -956,7 +956,7 @@ static int hdmi_eld_changed(snd_mixer_elem_t *melem, unsigned int mask)
|
|||
{
|
||||
pa_card *impl = snd_mixer_elem_get_callback_private(melem);
|
||||
snd_hctl_elem_t **_elem = snd_mixer_elem_get_private(melem), *elem;
|
||||
int device;
|
||||
int device, i;
|
||||
const char *old_monitor_name;
|
||||
pa_device_port *p;
|
||||
pa_hdmi_eld eld;
|
||||
|
|
@ -978,6 +978,15 @@ static int hdmi_eld_changed(snd_mixer_elem_t *melem, unsigned int mask)
|
|||
if (pa_alsa_get_hdmi_eld(elem, &eld) < 0)
|
||||
memset(&eld, 0, sizeof(eld));
|
||||
|
||||
// Strip trailing whitespace from monitor_name (primarily an NVidia driver bug for now)
|
||||
for (i = strlen(eld.monitor_name) - 1; i >= 0; i--) {
|
||||
if (eld.monitor_name[i] == '\n' || eld.monitor_name[i] == '\r' || eld.monitor_name[i] == '\t' ||
|
||||
eld.monitor_name[i] == ' ')
|
||||
eld.monitor_name[i] = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
old_monitor_name = pa_proplist_gets(p->proplist, PA_PROP_DEVICE_PRODUCT_NAME);
|
||||
if (eld.monitor_name[0] == '\0') {
|
||||
changed |= old_monitor_name != NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue