[pulseaudio-tickets] [PulseAudio] #593: How to modify pacat to route source to sink with minimum latency

PulseAudio trac-noreply at tango.0pointer.de
Tue Jun 30 18:43:47 PDT 2009


#593: How to modify pacat to  route source to sink with minimum latency
-------------------------+--------------------------------------------------
 Reporter:  knightk      |       Owner:  lennart
     Type:  enhancement  |      Status:  new    
Milestone:               |   Component:  clients
 Keywords:               |  
-------------------------+--------------------------------------------------
 I'm capturing stereo analog audio at rate=44100, format=s16le channels=2
 using module-alsa-source.
 I'm sinking out to USB at rate=44100, format=s16le, channels=2 using
 module-alsa-sink.

 pacat -r --format=s16le --rate=44100 --channels=2 | pacat -p
 --format=s16le --rate=44100 --channels=2

 is working but the latency is 1-2 seconds and a lot of packets are
 dropped.

 I want to modify pacat to route source to sink internally without piping.

 Can anyone confirm that my approach is OK, which is as follows:-
 1) in main() comment out stdio_event = mainloop_api->io_new (because I
 don't want the daemon to poll stdin/stdout callbacks.
 2) in context_state_callback() create both sink_stream and source_stream
 but only callback on the source_stream. Set up attr so that prebuf is 0
 and call pa_stream_trigger(sink_stream, stream_trigger_complet_cb, NULL)
 [for immediate playback], then connect for both source and sink streams.
 3) When source_callback is called pa_stream_peek(source_stream, &data,
 &length) then pa_stream_write(sink_stream, data, length,
 PA_SEEK_RELATIVE).

 I'm unsure about using zero_copy i.e. data points to captured packet in
 the source buffer. Am I transferring from the source buffer to the sink
 buffer?

-- 
Ticket URL: <http://pulseaudio.org/ticket/593>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server


More information about the pulseaudio-bugs mailing list