[pulseaudio-discuss] Detecting when data source disappears?

Steven Wawryk stevenw at acres.com.au
Tue May 23 01:44:56 UTC 2017


Sorry about reposting.  I botched up the subject line, messing up the 
threading.

>>>> 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.
> Could you please include the command sequence you are using? Maybe I can
> reproduce the problem here.
I've attached the CLI file and the shell script I use to run it. The 
sequence is:

./restart-pulse.sh dist/data/sine-2x6.pa
parec --device="test_sink0.monitor" --format=ulaw --rate=8000 
--channels=6 --channel-map="aux0,aux1,aux2,aux3,aux4,aux5" parec0.raw

Wait 10 seconds, then in another terminal:

pactl unload-module module-remap-sink # or pactl unload-module module-sine

Wait another 10 seconds, then kill parec with ctrl-c.  I then look at 
parec0.raw by importing it in audacity (u-law, 6channels, 8000 smp/sec).

>
>>>> 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 module-null-sink module.
>>>>
>>>> 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.
>>> That is expected behavior. null-sink.monitor is not different from 
>>> other
>>> sources, which means
>>> if there is no input to the null-sink, it will generate silence. It's
>>> like recording from an unplugged
>>> mic or line-in input.
>> And there's no silence detection?
> No, there isn't. This would have to be implemented on application level.
>
>>>> 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.
>>> Did you test if the same happens with parec? If yes, are there any log
>>> messages
>>> during the time?
>> Just did it and the result is the same.  Attached is the relevant part
>> of the syslog.
> This looks like a bug but the log is not verbose enough. The best way to
> get more
> information is to run pulseaudio with debugging enabled. You might need
> to disable
> autospawn in client.conf or stop the user service when using systemd
> before you
> can do so. Then run pulseaudio -vvvv from the command line.
Will do.



sine-2x6.pa


load-module module-null-sink sink_name=test_sink0 sink_properties=device.description=test0 format=ulaw rate=8000 channels=6 channel_map=aux0,aux1,aux2,aux3,aux4,aux5
load-module module-null-sink sink_name=test_sink1 sink_properties=device.description=test1 format=ulaw rate=8000 channels=6 channel_map=aux0,aux1,aux2,aux3,aux4,aux5

load-module module-remap-sink sink_name=remap_sink0  master=test_sink0 sink_properties=device.description=test_remap0  format=ulaw rate=8000 channels=1 master_channel_map=aux0  remix=no
load-module module-remap-sink sink_name=remap_sink1  master=test_sink1 sink_properties=device.description=test_remap1  format=ulaw rate=8000 channels=1 master_channel_map=aux0  remix=no
load-module module-remap-sink sink_name=remap_sink2  master=test_sink0 sink_properties=device.description=test_remap2  format=ulaw rate=8000 channels=1 master_channel_map=aux1  remix=no
load-module module-remap-sink sink_name=remap_sink3  master=test_sink1 sink_properties=device.description=test_remap3  format=ulaw rate=8000 channels=1 master_channel_map=aux1  remix=no
load-module module-remap-sink sink_name=remap_sink4  master=test_sink0 sink_properties=device.description=test_remap4  format=ulaw rate=8000 channels=1 master_channel_map=aux2  remix=no
load-module module-remap-sink sink_name=remap_sink5  master=test_sink1 sink_properties=device.description=test_remap5  format=ulaw rate=8000 channels=1 master_channel_map=aux2  remix=no
load-module module-remap-sink sink_name=remap_sink6  master=test_sink0 sink_properties=device.description=test_remap6  format=ulaw rate=8000 channels=1 master_channel_map=aux3  remix=no
load-module module-remap-sink sink_name=remap_sink7  master=test_sink1 sink_properties=device.description=test_remap7  format=ulaw rate=8000 channels=1 master_channel_map=aux3  remix=no
load-module module-remap-sink sink_name=remap_sink8  master=test_sink0 sink_properties=device.description=test_remap8  format=ulaw rate=8000 channels=1 master_channel_map=aux4  remix=no
load-module module-remap-sink sink_name=remap_sink9  master=test_sink1 sink_properties=device.description=test_remap9  format=ulaw rate=8000 channels=1 master_channel_map=aux4  remix=no
load-module module-remap-sink sink_name=remap_sink10 master=test_sink0 sink_properties=device.description=test_remap10 format=ulaw rate=8000 channels=1 master_channel_map=aux5  remix=no
load-module module-remap-sink sink_name=remap_sink11 master=test_sink1 sink_properties=device.description=test_remap11 format=ulaw rate=8000 channels=1 master_channel_map=aux5  remix=no

load-module module-sine sink=remap_sink0  frequency=100
load-module module-sine sink=remap_sink1  frequency=109
load-module module-sine sink=remap_sink2  frequency=119
load-module module-sine sink=remap_sink3  frequency=130
load-module module-sine sink=remap_sink4  frequency=141
load-module module-sine sink=remap_sink5  frequency=154
load-module module-sine sink=remap_sink6  frequency=168
load-module module-sine sink=remap_sink7  frequency=183
load-module module-sine sink=remap_sink8  frequency=200
load-module module-sine sink=remap_sink9  frequency=218
load-module module-sine sink=remap_sink10 frequency=238
load-module module-sine sink=remap_sink11 frequency=259

set-sink-volume test_sink0 0x10000
set-sink-volume test_sink1 0x10000

set-sink-mute test_sink0 no
set-sink-mute test_sink1 no

set-source-volume test_sink0.monitor 0x10000
set-source-volume test_sink1.monitor 0x10000

set-source-mute test_sink0.monitor no
set-source-mute test_sink1.monitor no

-------------- next part --------------
load-module module-null-sink sink_name=test_sink0 sink_properties=device.description=test0 format=ulaw rate=8000 channels=6 channel_map=aux0,aux1,aux2,aux3,aux4,aux5
load-module module-null-sink sink_name=test_sink1 sink_properties=device.description=test1 format=ulaw rate=8000 channels=6 channel_map=aux0,aux1,aux2,aux3,aux4,aux5

load-module module-remap-sink sink_name=remap_sink0  master=test_sink0 sink_properties=device.description=test_remap0  format=ulaw rate=8000 channels=1 master_channel_map=aux0  remix=no
load-module module-remap-sink sink_name=remap_sink1  master=test_sink1 sink_properties=device.description=test_remap1  format=ulaw rate=8000 channels=1 master_channel_map=aux0  remix=no
load-module module-remap-sink sink_name=remap_sink2  master=test_sink0 sink_properties=device.description=test_remap2  format=ulaw rate=8000 channels=1 master_channel_map=aux1  remix=no
load-module module-remap-sink sink_name=remap_sink3  master=test_sink1 sink_properties=device.description=test_remap3  format=ulaw rate=8000 channels=1 master_channel_map=aux1  remix=no
load-module module-remap-sink sink_name=remap_sink4  master=test_sink0 sink_properties=device.description=test_remap4  format=ulaw rate=8000 channels=1 master_channel_map=aux2  remix=no
load-module module-remap-sink sink_name=remap_sink5  master=test_sink1 sink_properties=device.description=test_remap5  format=ulaw rate=8000 channels=1 master_channel_map=aux2  remix=no
load-module module-remap-sink sink_name=remap_sink6  master=test_sink0 sink_properties=device.description=test_remap6  format=ulaw rate=8000 channels=1 master_channel_map=aux3  remix=no
load-module module-remap-sink sink_name=remap_sink7  master=test_sink1 sink_properties=device.description=test_remap7  format=ulaw rate=8000 channels=1 master_channel_map=aux3  remix=no
load-module module-remap-sink sink_name=remap_sink8  master=test_sink0 sink_properties=device.description=test_remap8  format=ulaw rate=8000 channels=1 master_channel_map=aux4  remix=no
load-module module-remap-sink sink_name=remap_sink9  master=test_sink1 sink_properties=device.description=test_remap9  format=ulaw rate=8000 channels=1 master_channel_map=aux4  remix=no
load-module module-remap-sink sink_name=remap_sink10 master=test_sink0 sink_properties=device.description=test_remap10 format=ulaw rate=8000 channels=1 master_channel_map=aux5  remix=no
load-module module-remap-sink sink_name=remap_sink11 master=test_sink1 sink_properties=device.description=test_remap11 format=ulaw rate=8000 channels=1 master_channel_map=aux5  remix=no

load-module module-sine sink=remap_sink0  frequency=100
load-module module-sine sink=remap_sink1  frequency=109
load-module module-sine sink=remap_sink2  frequency=119
load-module module-sine sink=remap_sink3  frequency=130
load-module module-sine sink=remap_sink4  frequency=141
load-module module-sine sink=remap_sink5  frequency=154
load-module module-sine sink=remap_sink6  frequency=168
load-module module-sine sink=remap_sink7  frequency=183
load-module module-sine sink=remap_sink8  frequency=200
load-module module-sine sink=remap_sink9  frequency=218
load-module module-sine sink=remap_sink10 frequency=238
load-module module-sine sink=remap_sink11 frequency=259

set-sink-volume test_sink0 0x10000
set-sink-volume test_sink1 0x10000

set-sink-mute test_sink0 no
set-sink-mute test_sink1 no

set-source-volume test_sink0.monitor 0x10000
set-source-volume test_sink1.monitor 0x10000

set-source-mute test_sink0.monitor no
set-source-mute test_sink1.monitor no
-------------- next part --------------
A non-text attachment was scrubbed...
Name: restart-pulse.sh
Type: application/x-shellscript
Size: 171 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20170523/c574c8e6/attachment.bin>


More information about the pulseaudio-discuss mailing list