mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	Rework memory management to allow shared memory data transfer. The central idea
is to allocate all audio memory blocks from a per-process memory pool which is available as read-only SHM segment to other local processes. Then, instead of writing the actual audio data to the socket just write references to this shared memory pool. To work optimally all memory blocks should now be of type PA_MEMBLOCK_POOL or PA_MEMBLOCK_POOL_EXTERNAL. The function pa_memblock_new() now generates memory blocks of this type by default. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1266 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									ff48681aae
								
							
						
					
					
						commit
						0e436a6926
					
				
					 45 changed files with 1235 additions and 312 deletions
				
			
		| 
						 | 
				
			
			@ -128,7 +128,7 @@ static int do_read(struct connection *c) {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
    if (!c->playback.current_memblock) {
 | 
			
		||||
        c->playback.current_memblock = pa_memblock_new(c->playback.fragment_size*2, c->protocol->core->memblock_stat);
 | 
			
		||||
        c->playback.current_memblock = pa_memblock_new(c->protocol->core->mempool, c->playback.fragment_size*2);
 | 
			
		||||
        assert(c->playback.current_memblock && c->playback.current_memblock->length >= l);
 | 
			
		||||
        c->playback.memblock_index = 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -369,8 +369,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
 | 
			
		|||
                pa_frame_size(&p->sample_spec),
 | 
			
		||||
                (size_t) -1,
 | 
			
		||||
                l/PLAYBACK_BUFFER_FRAGMENTS,
 | 
			
		||||
                NULL,
 | 
			
		||||
                p->core->memblock_stat);
 | 
			
		||||
                NULL);
 | 
			
		||||
        assert(c->input_memblockq);
 | 
			
		||||
        pa_iochannel_socket_set_rcvbuf(io, l/PLAYBACK_BUFFER_FRAGMENTS*5);
 | 
			
		||||
        c->playback.fragment_size = l/10;
 | 
			
		||||
| 
						 | 
				
			
			@ -406,8 +405,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
 | 
			
		|||
                pa_frame_size(&p->sample_spec),
 | 
			
		||||
                1,
 | 
			
		||||
                0,
 | 
			
		||||
                NULL,
 | 
			
		||||
                p->core->memblock_stat);
 | 
			
		||||
                NULL);
 | 
			
		||||
        pa_iochannel_socket_set_sndbuf(io, l/RECORD_BUFFER_FRAGMENTS*2);
 | 
			
		||||
        pa_source_notify(c->source_output->source);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue