Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write to port audio stream failed. #3

Closed
dan2wik opened this issue Sep 23, 2017 · 7 comments
Closed

Write to port audio stream failed. #3

dan2wik opened this issue Sep 23, 2017 · 7 comments

Comments

@dan2wik
Copy link

dan2wik commented Sep 23, 2017

I recently compiled quiet-lwip and it's examples but none of the examples are working. The console output is:

pi@raspberrypi:~/quiet-lwip/build/bin $ ./discovery_server ALSA lib confmisc.c:674:(snd_determine_driver) could not open control for card 0 ALSA lib conf.c:3339:(snd_config_hooks_call) function snd_config_hook_load_for_all_cards returned error: Invalid argument ALSA lib confmisc.c:674:(snd_determine_driver) could not open control for card 0 ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: Invalid argument ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: Invalid argument ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: Invalid argument ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: Invalid argument ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.default ALSA lib confmisc.c:674:(snd_determine_driver) could not open control for card 0 ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: Invalid argument ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: Invalid argument ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: Invalid argument ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: Invalid argument ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM sysdefault ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958 ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib confmisc.c:674:(snd_determine_driver) could not open control for card 0 ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: Invalid argument ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: Invalid argument ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: Invalid argument ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: Invalid argument ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM dmix Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream failed to write to port audio stream, Can't write to a callback stream
The 'failed to write to port audio...' is printed over 70 times per second and lasts until the program is killed.

I was testing originally on a Raspberry Pi3 but confirmed the issue on a 64bit laptop running ubuntu 16.04.

The commands used to install on both were:
sudo apt update sudo apt install -y cmake autoconf automake libtool git mkdir lwip cd lwip git clone https://github.com/quiet/quiet-lwip git clone https://github.com/quiet/quiet git clone https://github.com/quiet/libfec git clone https://github.com/akheron/jansson git clone https://github.com/quiet/quiet-dsp -b devel wget http:https://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz wget http:https://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz wget ftp:https://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.4.1.tar.bz2 tar -xvf alsa-lib-1.1.4.1.tar.bz2 tar -zxvf pa_stable_v190600_20161030.tgz tar -zxvf libsndfile-1.0.28.tar.gz cd alsa-lib-1.1.4.1/ ./configure make -j4 sudo make install cd ../libfec ./configure make -j4 sudo make install cd ../libsndfile-1.0.28 ./configure make -j4 sudo make install cd ../jansson autoreconf -fi ./configure make -j4 sudo make install cd ../portaudio ./configure make -j4 sudo make install cd ../quiet-dsp ./bootstrap.sh ./configure make -j4 sudo make install cd ../quiet ./bootstrap cd build sudo make install cd ../../quiet-lwip mkdir build cd build cmake .. make make examples cd ../../ sudo ldconfig

Please let me know if there is any additional information I need to provide you with.

@cegea
Copy link

cegea commented Oct 30, 2017

Hi,

It is a configuration issue of the RPi Raspibian. Check here for the solution https://github.com/alexa/alexa-avs-sample-app/issues/277

@cegea
Copy link

cegea commented Oct 31, 2017

Hi,

However, after fixing the ALSA configuration I´ve kept getting the same error message while running discovery_server:

failed to write to port audio stream, Can't write to a callback stream

What can I be doing wrong?
Thank you

@arilotter
Copy link

I get a similar error when running any examples.
As a regular user:

ALSA lib pcm_dsnoop.c:572:(snd_pcm_dsnoop_open) unable to create IPC semaphore
ALSA lib pcm_dmix.c:996:(snd_pcm_dmix_open) unable to create IPC semaphore
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_dsnoop.c:572:(snd_pcm_dsnoop_open) unable to create IPC semaphore
ALSA lib pcm_dmix.c:996:(snd_pcm_dmix_open) unable to create IPC semaphore
ALSA lib pcm_dmix.c:996:(snd_pcm_dmix_open) unable to create IPC semaphore
failed to write to port audio stream, Can't write to a callback stream
failed to write to port audio stream, Can't write to a callback stream

the last line repeats forever.

As root,

ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:867:(find_matching_chmap) Found no matching channel map
failed to write to port audio stream, Can't write to a callback stream
failed to write to port audio stream, Can't write to a callback stream

the last line repeats forever.

@cegea
Copy link

cegea commented Nov 22, 2017

@arilotter ,
Did you find any solution?

@robertsdionne
Copy link

I'm seeing the same output on MacOS. The portaudio function PaMacCore_Initialize initializes the callback stream interface with PaUtil_DummyRead and PaUtil_DummyWrite, which just return the error paCanNotWriteToACallbackStream.

@brian-armstrong
Copy link
Member

Hi,

Sorry, that's correct. I changed how quiet's portaudio interface works and in the meantime, quiet-lwip broke. I'd started fixing this but prioritized some other stuff. Thanks for reminding me that I need to fix this.

@brian-armstrong
Copy link
Member

Also, to add more context, here's what caused this breakage.

Previously, if you used quiet's portaudio interface (as quiet-lwip does), you had to continuously call quiet_portaudio_encoder_emit() in order to "turn the crank" and get quiet to emit sound. This was an annoying wart on the interface, and it used Portaudio's blocking send interface which has more latency. I wanted to move from that to using PA's callbacks, which would invoke automatically.

However, quiet-lwip also took advantage of having this control as a sort of crude collision avoidance with another transmitter. When it detected another transmitter sending, it could stop calling emit until the other sender finished. The new interface doesn't make this possible, and it seems the cleanest thing would be to add a "pause" functionality to quiet. I haven't got to it yet. It's not great that quiet-lwip broke in the meantime though, and I'd like to find some way to fix it.

@dan2wik dan2wik closed this as completed Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants