[pulseaudio-discuss] Detecting when data source disappears?
stevenw at acres.com.au
Wed May 17 02:28:48 UTC 2017
I've been reading up and experimenting on both the simple and async
APIs. In one experiment, I used a CLI file that sets up a set of
module-sine modules with output remapped by module-remap-sink modules to
a stream fed to a module-null-sink module.
I then wrote 2 programs, one using the simple API and the other the
async API to read date from the module-null-sink monitor source and
write the data to file (both based on examples to provide "parec"
functionality). Then I could unload either all the module-sine modules
or all the module-remap-sink modules to interrupt the data source to the
Both programs gave the same result, which I don't completely understand.
The issues I've found are:
1. After the data source is gone, the program continues to write data to
file. There doesn't seem to be any way to detect a stream of "zero"
data using the APIs.
2. If I run it for 20 seconds, with 10 seconds of sinusoidal data
followed by 10 seconds of null data, the file ends up with anything from
30 to 40 seconds worth of data in it.
3. The files written from case 2, above, show the initial sinusoidal
data as expected, but then, following data stream interruption, about 5
to 10 seconds of switching back and forth between segments of sinusoidal
data and null data, before finally settling to null data only till the
end of file.
Can anyone explain to me why it behaves like this? Or if there's
something in the async API that I'm missing in detecting null data?
More information about the pulseaudio-discuss