mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: don't override initial volume/mute
When we are asked to apply the initial volume/mute, don't overwrite it with the default volume. Fixes #3306
This commit is contained in:
		
							parent
							
								
									20434e8669
								
							
						
					
					
						commit
						b464d2145d
					
				
					 1 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
					@ -1097,13 +1097,17 @@ static void stream_control_info(void *data, uint32_t id,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (id) {
 | 
						switch (id) {
 | 
				
			||||||
	case SPA_PROP_channelVolumes:
 | 
						case SPA_PROP_channelVolumes:
 | 
				
			||||||
		stream->volume.channels = control->n_values;
 | 
							if (!stream->volume_set) {
 | 
				
			||||||
		memcpy(stream->volume.values, control->values, control->n_values * sizeof(float));
 | 
								stream->volume.channels = control->n_values;
 | 
				
			||||||
		pw_log_info("stream %p: volume changed %f", stream, stream->volume.values[0]);
 | 
								memcpy(stream->volume.values, control->values, control->n_values * sizeof(float));
 | 
				
			||||||
 | 
								pw_log_info("stream %p: volume changed %f", stream, stream->volume.values[0]);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case SPA_PROP_mute:
 | 
						case SPA_PROP_mute:
 | 
				
			||||||
		stream->muted = control->values[0] >= 0.5;
 | 
							if (!stream->muted_set) {
 | 
				
			||||||
		pw_log_info("stream %p: mute changed %d", stream, stream->muted);
 | 
								stream->muted = control->values[0] >= 0.5;
 | 
				
			||||||
 | 
								pw_log_info("stream %p: mute changed %d", stream, stream->muted);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1208,11 +1212,13 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod *
 | 
				
			||||||
		struct pw_manager_object *peer;
 | 
							struct pw_manager_object *peer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (stream->volume_set) {
 | 
							if (stream->volume_set) {
 | 
				
			||||||
 | 
								stream->volume_set = false;
 | 
				
			||||||
			pw_stream_set_control(stream->stream,
 | 
								pw_stream_set_control(stream->stream,
 | 
				
			||||||
				SPA_PROP_channelVolumes, stream->volume.channels, stream->volume.values, 0);
 | 
									SPA_PROP_channelVolumes, stream->volume.channels, stream->volume.values, 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (stream->muted_set) {
 | 
							if (stream->muted_set) {
 | 
				
			||||||
			float val = stream->muted ? 1.0f : 0.0f;
 | 
								float val = stream->muted ? 1.0f : 0.0f;
 | 
				
			||||||
 | 
								stream->muted_set = false;
 | 
				
			||||||
			pw_stream_set_control(stream->stream,
 | 
								pw_stream_set_control(stream->stream,
 | 
				
			||||||
				SPA_PROP_mute, 1, &val, 0);
 | 
									SPA_PROP_mute, 1, &val, 0);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue