mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	sink, source: Allow reconfigure to change the complete sample spec
For the passthrough case, we allow the entire sink sample spec to be changed in reconfigure. This will be needed for high bitrate formats. We duplicate this for sources to keep things in sync as well. Relatedly, we also restore the original spec on leaving passthrough mode. We were getting away with not doing so in the past as, while incorrect, not restoring the rate was not disastrous. With the ability to change channel count, not restoring breaks the meaning of profiles entirely. The saving and restoration logic is restricted to sink/source reconfiguration code to allow it to be self-contained and easier to reason about. All this also applies to the channel map. We don't actually explicitly reconfigure the channel map at the moment, but since pa_sink/source_reconfigure() can now change the channel count, it seems to make sense to include the channel map along with that API change for future use.
This commit is contained in:
		
							parent
							
								
									9360dce76d
								
							
						
					
					
						commit
						0d85b18460
					
				
					 9 changed files with 242 additions and 76 deletions
				
			
		| 
						 | 
				
			
			@ -108,7 +108,9 @@ struct pa_source {
 | 
			
		|||
    bool save_muted:1;
 | 
			
		||||
    bool port_changing:1;
 | 
			
		||||
 | 
			
		||||
    /* Saved volume state while we're in passthrough mode */
 | 
			
		||||
    /* Saved state while we're in passthrough mode */
 | 
			
		||||
    pa_sample_spec saved_spec;
 | 
			
		||||
    pa_channel_map saved_map;
 | 
			
		||||
    pa_cvolume saved_volume;
 | 
			
		||||
    bool saved_save_volume:1;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -226,7 +228,7 @@ struct pa_source {
 | 
			
		|||
 | 
			
		||||
    /* Called whenever device parameters need to be changed. Called from
 | 
			
		||||
     * main thread. */
 | 
			
		||||
    void (*reconfigure)(pa_source *s, pa_sample_spec *spec, bool passthrough);
 | 
			
		||||
    int (*reconfigure)(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough);
 | 
			
		||||
 | 
			
		||||
    /* Contains copies of the above data so that the real-time worker
 | 
			
		||||
     * thread can work without access locking */
 | 
			
		||||
| 
						 | 
				
			
			@ -419,7 +421,7 @@ bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist
 | 
			
		|||
 | 
			
		||||
int pa_source_set_port(pa_source *s, const char *name, bool save);
 | 
			
		||||
 | 
			
		||||
void pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough);
 | 
			
		||||
int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, pa_channel_map *map, bool passthrough, bool restore);
 | 
			
		||||
 | 
			
		||||
unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
 | 
			
		||||
unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue