[asterisk-commits] tilghman: trunk r168526 - in /trunk: ./ channels/chan_alsa.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 12 17:45:52 CST 2009
Author: tilghman
Date: Mon Jan 12 17:45:51 2009
New Revision: 168526
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168526
Log:
Merged revisions 167095 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r167095 | tilghman | 2008-12-31 18:01:22 -0600 (Wed, 31 Dec 2008) | 5 lines
Repeat attempts to write when we receive -EAGAIN from the driver, as detailed
in the ALSA sample code (see http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html#a32)
Reported by: Jerry Geis (via the -users list)
Fixed by: me (license 14)
........
Modified:
trunk/ (props changed)
trunk/channels/chan_alsa.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_alsa.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_alsa.c?view=diff&rev=168526&r1=168525&r2=168526
==============================================================================
--- trunk/channels/chan_alsa.c (original)
+++ trunk/channels/chan_alsa.c Mon Jan 12 17:45:51 2009
@@ -381,13 +381,17 @@
state = snd_pcm_state(alsa.ocard);
if (state == SND_PCM_STATE_XRUN)
snd_pcm_prepare(alsa.ocard);
- res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2);
+ while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {
+ usleep(1);
+ }
if (res == -EPIPE) {
#if DEBUG
ast_debug(1, "XRUN write\n");
#endif
snd_pcm_prepare(alsa.ocard);
- res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2);
+ while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {
+ usleep(1);
+ }
if (res != len / 2) {
ast_log(LOG_ERROR, "Write error: %s\n", snd_strerror(res));
res = -1;
More information about the asterisk-commits
mailing list