mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	when alsa tweaks our sample_spec make sure we adjust the watermark accordingly
This commit is contained in:
		
							parent
							
								
									1c86267e1f
								
							
						
					
					
						commit
						798e39a5b6
					
				
					 2 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -1496,7 +1496,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    const char *dev_id = NULL;
 | 
					    const char *dev_id = NULL;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss, requested_ss;
 | 
				
			||||||
    pa_channel_map map;
 | 
					    pa_channel_map map;
 | 
				
			||||||
    uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
 | 
					    uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
 | 
				
			||||||
    snd_pcm_uframes_t period_frames, tsched_frames;
 | 
					    snd_pcm_uframes_t period_frames, tsched_frames;
 | 
				
			||||||
| 
						 | 
					@ -1515,6 +1515,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    requested_ss = ss;
 | 
				
			||||||
    frame_size = pa_frame_size(&ss);
 | 
					    frame_size = pa_frame_size(&ss);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nfrags = m->core->default_n_fragments;
 | 
					    nfrags = m->core->default_n_fragments;
 | 
				
			||||||
| 
						 | 
					@ -1686,7 +1687,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
				
			||||||
    u->fragment_size = frag_size = (uint32_t) (period_frames * frame_size);
 | 
					    u->fragment_size = frag_size = (uint32_t) (period_frames * frame_size);
 | 
				
			||||||
    u->nfragments = nfrags;
 | 
					    u->nfragments = nfrags;
 | 
				
			||||||
    u->hwbuf_size = u->fragment_size * nfrags;
 | 
					    u->hwbuf_size = u->fragment_size * nfrags;
 | 
				
			||||||
    u->tsched_watermark = tsched_watermark;
 | 
					    u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, &requested_ss), &u->sink->sample_spec);
 | 
				
			||||||
    pa_cvolume_mute(&u->hardware_volume, u->sink->sample_spec.channels);
 | 
					    pa_cvolume_mute(&u->hardware_volume, u->sink->sample_spec.channels);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (use_tsched) {
 | 
					    if (use_tsched) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1344,7 +1344,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    struct userdata *u = NULL;
 | 
					    struct userdata *u = NULL;
 | 
				
			||||||
    const char *dev_id = NULL;
 | 
					    const char *dev_id = NULL;
 | 
				
			||||||
    pa_sample_spec ss;
 | 
					    pa_sample_spec ss, requested_ss;
 | 
				
			||||||
    pa_channel_map map;
 | 
					    pa_channel_map map;
 | 
				
			||||||
    uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
 | 
					    uint32_t nfrags, hwbuf_size, frag_size, tsched_size, tsched_watermark;
 | 
				
			||||||
    snd_pcm_uframes_t period_frames, tsched_frames;
 | 
					    snd_pcm_uframes_t period_frames, tsched_frames;
 | 
				
			||||||
| 
						 | 
					@ -1362,6 +1362,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
				
			||||||
        goto fail;
 | 
					        goto fail;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    requested_ss = ss;
 | 
				
			||||||
    frame_size = pa_frame_size(&ss);
 | 
					    frame_size = pa_frame_size(&ss);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    nfrags = m->core->default_n_fragments;
 | 
					    nfrags = m->core->default_n_fragments;
 | 
				
			||||||
| 
						 | 
					@ -1528,7 +1529,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
				
			||||||
    u->fragment_size = frag_size = (uint32_t) (period_frames * frame_size);
 | 
					    u->fragment_size = frag_size = (uint32_t) (period_frames * frame_size);
 | 
				
			||||||
    u->nfragments = nfrags;
 | 
					    u->nfragments = nfrags;
 | 
				
			||||||
    u->hwbuf_size = u->fragment_size * nfrags;
 | 
					    u->hwbuf_size = u->fragment_size * nfrags;
 | 
				
			||||||
    u->tsched_watermark = tsched_watermark;
 | 
					    u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, &requested_ss), &u->source->sample_spec);
 | 
				
			||||||
    pa_cvolume_mute(&u->hardware_volume, u->source->sample_spec.channels);
 | 
					    pa_cvolume_mute(&u->hardware_volume, u->source->sample_spec.channels);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (use_tsched) {
 | 
					    if (use_tsched) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue