[pulseaudio-discuss] Playing samples with different sample_spec's
roman.dmitrienko at gmail.com
Tue Jun 19 05:56:47 PDT 2012
I am developing an application that receives a stream of audio samples
from a remote server via custom UDP protocol. The stream consists of
small sequences of samples, each sequence may have different number of
channels (interleaved) and rate.
As I understand, the sample_spec of the stream can only be set during
the stream's creation (pa_simple_new, pa_stream_new, etc) and there is
no way to switch it afterwards.
My question is: what would be the most efficient approach to these
samples' playback in PulseAudio? I see three options:
1. Keep a single PulseAudio stream, manually resample the sample
sequences and mix channels when needed (in order to feed PulseAudio
with samples of the same sample_spec)
2. Keep a single PulseAudio stream, close and reopen it with new
sample_spec when specs change
3. Keep a number of streams, one for every kind of samples I have to work with
Option 1 seems like a lot of manual work, and pretty much
resource-consuming, too. Option 2 seems to be terribly inefficient.
Option 3 looks like probably the best one, but I am concerned about
resource consumption. Is there something I may be missing?
Thank you in advance!
More information about the pulseaudio-discuss