mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	pipe-sink: align buffer
The pipe buffer is likely to be a power of 2 (e.g. 4096 bytes). This works nicely for 16 bit stereo samples but breaks when using 24 bit samples. This patch aligns the buffer using pa_frame_align().
This commit is contained in:
		
							parent
							
								
									32c2a6d64a
								
							
						
					
					
						commit
						9e4ee38c17
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -123,7 +123,7 @@ static int process_render(struct userdata *u) {
 | 
			
		|||
    pa_assert(u);
 | 
			
		||||
 | 
			
		||||
    if (u->memchunk.length <= 0)
 | 
			
		||||
        pa_sink_render(u->sink, pa_pipe_buf(u->fd), &u->memchunk);
 | 
			
		||||
        pa_sink_render(u->sink, pa_frame_align(pa_pipe_buf(u->fd), &u->sink->sample_spec), &u->memchunk);
 | 
			
		||||
 | 
			
		||||
    pa_assert(u->memchunk.length > 0);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -301,7 +301,7 @@ int pa__init(pa_module *m) {
 | 
			
		|||
 | 
			
		||||
    pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
 | 
			
		||||
    pa_sink_set_rtpoll(u->sink, u->rtpoll);
 | 
			
		||||
    pa_sink_set_max_request(u->sink, pa_pipe_buf(u->fd));
 | 
			
		||||
    pa_sink_set_max_request(u->sink, pa_frame_align(pa_pipe_buf(u->fd), &u->sink->sample_spec));
 | 
			
		||||
    pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(pa_pipe_buf(u->fd), &u->sink->sample_spec));
 | 
			
		||||
 | 
			
		||||
    u->rtpoll_item = pa_rtpoll_item_new(u->rtpoll, PA_RTPOLL_NEVER, 1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue