mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05: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
							
								
									3efa3483db
								
							
						
					
					
						commit
						e6bcc415fc
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -955,7 +955,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;
 | 
			
		||||
| 
						 | 
				
			
			@ -977,6 +977,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