Alsa Write Error Broken Pipe
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about
Cat Write Error Broken Pipe
Stack Overflow the company Business Learn more about hiring developers or posting ads with grep write error broken pipe us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is
Ls Write Error Broken Pipe
a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ALSA: cannot recovery from underrun, prepare failed: Broken pipe up vote 1 down vote ls write error broken pipe python favorite I'm writing a program that reads from two mono ALSA devices and writes them to one stereo ALSA device. I use three threads and ping-pong buffer to manage them. Two reading threads and one writing threads. Their configurations are as follows: // Capture ALSA device alsaBufferSize = 16384; alsaCaptureChunkSize = 4096; bitsPerSample = 16; samplingFrequency = 24000; numOfChannels = 1; block = true; accessType = SND_PCM_ACCESS_RW_INTERLEAVED; // Playback device (only echo write error broken pipe list params that are different from above) alsaBufferSize = 16384 * 2; numOfChannels = 2; accessType = SND_PCM_ACCESS_RW_NON_INTERLEAVED; Two reading threads would write ping buffer and then pong buffer. The writing thread would wait for any of two buffer ready, lock it, read from it, and then unlock it. But when I run this program, xrun appears and can't be recovered. ALSA lib pcm.c:7316:(snd_pcm_recover) underrun occurred ALSA lib pcm.c:7319:(snd_pcm_recover) cannot recovery from underrun, prepare failed: Broken pipe Below is my code for writing to ALSA playback device: bool CALSAWriter::writen(uint8_t** a_pOutputBuffer, uint32_t a_rFrames) { bool ret = false; // 1. write audio chunk from ALSA const snd_pcm_sframes_t alsaCaptureChunkSize = static_cast
be bold an merge the two pages! WARNING: Asynchronous Playback is part of a not safe subset of ALSA for some Linux distributions that use pulse audio like Ubuntu. Please consider using safer ways on your programs like polling if you are going to use
Write Error Broken Pipe Android
Pulse Audio. Since none of the existing documentation was thorough enough for me to socketclient write error broken pipe understand what was really going on in ALSA at times, I'm going to write up this partial document on how I
Snd_pcm_recover
got ALSA output to work in my application, and what I think is going on, describing it to my best abilities. Hopefully, some Developer With A Clue will extend or fix this document. Comments by me http://stackoverflow.com/questions/26545139/alsa-cannot-recovery-from-underrun-prepare-failed-broken-pipe in this file are italic, and probably means something wasn't and still isn't quite obvious to me. Fore-mentioned developers are welcome to enlighten me. This document describes just one of the methods for using ALSA. Specifically, I'm going to use regular writes here, and use asynchronous notification to find out when I can write to the ALSA buffer. Besides asynchronous notification, you can also simply poll like you would with any other http://alsa.opensrc.org/HowTo_Asynchronous_Playback file descriptor. And besides regular writes, you can also mmap the buffer and write directly to memory. I'm not going to cover these, though, but you can find an example of it all in the alsa-lib API reference here: http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html Contents 1 Setting up the device 2 Setting up parameters on the device 2.1 Hardware parameters 2.2 Software parameters 3 Preparing the device 4 The callback function Setting up the device The first step is naturally to open the sound device. /* This holds the error code returned */ int err; /* Our device handle */ snd_pcm_t *pcm_handle = NULL; /* The device name */ const char *device_name = "default"; /* Open the device */ err = snd_pcm_open (&pcm_handle, device_name, SND_PCM_STREAM_PLAYBACK, 0); /* Error check */ if (err < 0) { fprintf (stderr, "cannot open audio deviceĀ %s (%s)\n", device_name, snd_strerror (err)); pcm_handle = NULL; return; } This should look fairly straight-forward. We need a handle, a variable holding the return value of our calls and a device name to tell ALSA which device to open for us. The device name is a standard ALSA device identifier you've probably encountered already, such as "hw:0,0" to indicate the first device. The value "default" we use here opens up either the first available device or whatever
found for "GET /viewtopic.php" VideoLAN Forum Home All times are UTC+02:00 Delete all board cookies The team Powered by phpBB Forum Software © phpBB Limited GZIP: On
MPlayer and ALSA Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Hi, >I have problems using Mplayer (MPlayer SVN-r30100-snapshot-4.4.1) with ALSA. > >I want to play a RTP stream accessed through RTSP. When I use Ethernet >interface, audio playback works well but when I use Wifi, audio playback >works most of the time but sometimes I have the following message : > >[AO_ALSA] Write error: Broken pipe Audio : >100.1% > >[AO_ALSA] Trying to reset soundcard. >>I doubt your problem is related to mplayer, but rather caused by the quality >>of your wireless connection. You will generally want to use Ethernet or fast >>PLC for streaming, which are way more reliable (and fast) than wireless >>communication. A little googling on that topic will tell you the same! >>just my 2 cents, >>Seb. Thanks for you answer, I agree with you but it's for a demonstration and the demonstration will be better using Wifi than Ethernet :). Moreover, it works when I use OSS (but sometimes I have problem of multiple access to /dev/dsp file so I prefer use ALSA). >>Does -cache help? >>Carl Eugen Thanks too, I see no improvement using -cache option : ./mplayer rtsp://mylink/monfichier_mp3.mp4 -ao alsa -ac ffmp3 -cache 8192 -cache-min 4 Message is always the same when sound is crashing : [AO_ALSA] Write error: Broken pipe Audio : 100.1% [AO_ALSA] Trying to reset soundcard. Another indication : when I use ALSA, pourcentage indicated (100 * audio_time_usage / mpctx->delay) is always about "100%". When I use OSS, the value is smaller : about "10%" maximum. I have noticed that when I use ALSA, it tries to decode much data at the same time than when I use OSS. Maybe, there is a link ? Thanks in advance, Pierre Previous message: [MPlayer-users] image capture problem - latest version of mplayer Next message: [MPlayer-users] Problem using MPlayer and ALSA Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the MPlayer-users mailing list