mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	null-sink: add an option that allows rewinds to be disabled
This commit is contained in:
		
							parent
							
								
									b89d33bb18
								
							
						
					
					
						commit
						16a7f1e02c
					
				
					 1 changed files with 12 additions and 1 deletions
				
			
		| 
						 | 
					@ -53,7 +53,8 @@ PA_MODULE_USAGE(
 | 
				
			||||||
        "rate=<sample rate> "
 | 
					        "rate=<sample rate> "
 | 
				
			||||||
        "channels=<number of channels> "
 | 
					        "channels=<number of channels> "
 | 
				
			||||||
        "channel_map=<channel map>"
 | 
					        "channel_map=<channel map>"
 | 
				
			||||||
        "formats=<semi-colon separated sink formats>");
 | 
					        "formats=<semi-colon separated sink formats>"
 | 
				
			||||||
 | 
					        "norewinds=<disable rewinds>");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_SINK_NAME "null"
 | 
					#define DEFAULT_SINK_NAME "null"
 | 
				
			||||||
#define BLOCK_USEC (PA_USEC_PER_SEC * 2)
 | 
					#define BLOCK_USEC (PA_USEC_PER_SEC * 2)
 | 
				
			||||||
| 
						 | 
					@ -71,6 +72,8 @@ struct userdata {
 | 
				
			||||||
    pa_usec_t timestamp;
 | 
					    pa_usec_t timestamp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_idxset *formats;
 | 
					    pa_idxset *formats;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool norewinds;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char* const valid_modargs[] = {
 | 
					static const char* const valid_modargs[] = {
 | 
				
			||||||
| 
						 | 
					@ -81,6 +84,7 @@ static const char* const valid_modargs[] = {
 | 
				
			||||||
    "channels",
 | 
					    "channels",
 | 
				
			||||||
    "channel_map",
 | 
					    "channel_map",
 | 
				
			||||||
    "formats",
 | 
					    "formats",
 | 
				
			||||||
 | 
					    "norewinds",
 | 
				
			||||||
    NULL
 | 
					    NULL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -169,6 +173,9 @@ static void process_rewind(struct userdata *u, pa_usec_t now) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (u->norewinds)
 | 
				
			||||||
 | 
					        goto do_nothing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rewind_nbytes = u->sink->thread_info.rewind_nbytes;
 | 
					    rewind_nbytes = u->sink->thread_info.rewind_nbytes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!PA_SINK_IS_OPENED(u->sink->thread_info.state) || rewind_nbytes <= 0)
 | 
					    if (!PA_SINK_IS_OPENED(u->sink->thread_info.state) || rewind_nbytes <= 0)
 | 
				
			||||||
| 
						 | 
					@ -349,6 +356,10 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if(pa_modargs_get_value_boolean(ma, "norewinds", &u->norewinds) < 0){
 | 
				
			||||||
 | 
					        pa_log("Failed to disable rewinds.");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY);
 | 
					    u->sink = pa_sink_new(m->core, &data, PA_SINK_LATENCY|PA_SINK_DYNAMIC_LATENCY);
 | 
				
			||||||
    pa_sink_new_data_done(&data);
 | 
					    pa_sink_new_data_done(&data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue