mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	match: Use the SINK_INPUT_FIXATE hook instead of NEW.
The callback relies on the sample spec being finalized, which is not true with the NEW hook. In case you're wondering about the "hook EARLY - 1, to match before stream-restore" comment that was not changed even though the code that the comment concerned was changed: the comment was apparently written at a time when module-stream-restore used the NEW hook too, and later stream-restore has been changed to use the FIXATE hook. So, the comment was wrong/nonsensical before this patch. Since these two modules now use the same hook again, the comment makes sense again. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=55135
This commit is contained in:
		
							parent
							
								
									0da87df4ec
								
							
						
					
					
						commit
						0a8634f03e
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
					@ -80,7 +80,7 @@ struct rule {
 | 
				
			||||||
struct userdata {
 | 
					struct userdata {
 | 
				
			||||||
    struct rule *rules;
 | 
					    struct rule *rules;
 | 
				
			||||||
    char *property_key;
 | 
					    char *property_key;
 | 
				
			||||||
    pa_hook_slot *sink_input_new_hook_slot;
 | 
					    pa_hook_slot *sink_input_fixate_hook_slot;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int load_rules(struct userdata *u, const char *filename) {
 | 
					static int load_rules(struct userdata *u, const char *filename) {
 | 
				
			||||||
| 
						 | 
					@ -213,7 +213,7 @@ finish:
 | 
				
			||||||
    return ret;
 | 
					    return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_new_data *si, struct userdata *u) {
 | 
					static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_input_new_data *si, struct userdata *u) {
 | 
				
			||||||
    struct rule *r;
 | 
					    struct rule *r;
 | 
				
			||||||
    const char *n;
 | 
					    const char *n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -264,7 +264,7 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* hook EARLY - 1, to match before stream-restore */
 | 
					    /* hook EARLY - 1, to match before stream-restore */
 | 
				
			||||||
    u->sink_input_new_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], PA_HOOK_EARLY - 1, (pa_hook_cb_t) sink_input_new_hook_callback, u);
 | 
					    u->sink_input_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], PA_HOOK_EARLY - 1, (pa_hook_cb_t) sink_input_fixate_hook_callback, u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_modargs_free(ma);
 | 
					    pa_modargs_free(ma);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					@ -286,8 +286,8 @@ void pa__done(pa_module*m) {
 | 
				
			||||||
    if (!(u = m->userdata))
 | 
					    if (!(u = m->userdata))
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->sink_input_new_hook_slot)
 | 
					    if (u->sink_input_fixate_hook_slot)
 | 
				
			||||||
        pa_hook_slot_free(u->sink_input_new_hook_slot);
 | 
					        pa_hook_slot_free(u->sink_input_fixate_hook_slot);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->property_key)
 | 
					    if (u->property_key)
 | 
				
			||||||
        pa_xfree(u->property_key);
 | 
					        pa_xfree(u->property_key);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue