mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	Some crappy hardware generate noise on the output when reading input. To
avoid triggering this needlesly we tweak the algorithm a bit to avoid reading when nothing is connected to the source. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@454 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									289c914b47
								
							
						
					
					
						commit
						cb2a7ed028
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -161,7 +161,7 @@ static void do_read(struct userdata *u) {
 | 
				
			||||||
    int loop = 0;
 | 
					    int loop = 0;
 | 
				
			||||||
    assert(u);
 | 
					    assert(u);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    if (!u->source || !pa_iochannel_is_readable(u->io))
 | 
					    if (!u->source || !pa_iochannel_is_readable(u->io) || !pa_idxset_size(u->source->outputs))
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    update_usage(u);
 | 
					    update_usage(u);
 | 
				
			||||||
| 
						 | 
					@ -209,6 +209,12 @@ static void io_callback(PA_GCC_UNUSED pa_iochannel *io, void*userdata) {
 | 
				
			||||||
    do_read(u);
 | 
					    do_read(u);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void source_notify_cb(pa_source *s) {
 | 
				
			||||||
 | 
					    struct userdata *u = s->userdata;
 | 
				
			||||||
 | 
					    assert(u);
 | 
				
			||||||
 | 
					    do_read(u);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_usec_t sink_get_latency_cb(pa_sink *s) {
 | 
					static pa_usec_t sink_get_latency_cb(pa_sink *s) {
 | 
				
			||||||
    pa_usec_t r = 0;
 | 
					    pa_usec_t r = 0;
 | 
				
			||||||
    int arg;
 | 
					    int arg;
 | 
				
			||||||
| 
						 | 
					@ -329,6 +335,7 @@ int pa__init(pa_core *c, pa_module*m) {
 | 
				
			||||||
        u->source = pa_source_new(c, PA_TYPEID_OSS, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss);
 | 
					        u->source = pa_source_new(c, PA_TYPEID_OSS, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss);
 | 
				
			||||||
        assert(u->source);
 | 
					        assert(u->source);
 | 
				
			||||||
        u->source->userdata = u;
 | 
					        u->source->userdata = u;
 | 
				
			||||||
 | 
					        u->source->notify = source_notify_cb;
 | 
				
			||||||
        u->source->get_latency = source_get_latency_cb;
 | 
					        u->source->get_latency = source_get_latency_cb;
 | 
				
			||||||
        pa_source_set_owner(u->source, m);
 | 
					        pa_source_set_owner(u->source, m);
 | 
				
			||||||
        u->source->description = pa_sprintf_malloc("Open Sound System PCM on '%s'", p);
 | 
					        u->source->description = pa_sprintf_malloc("Open Sound System PCM on '%s'", p);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue