Bug 147546 - USB Alsa and esound == garbled sound
USB Alsa and esound == garbled sound
Status: CLOSED INSUFFICIENT_DATA
Product: Fedora
Classification: Fedora
Component: esound (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: John (J5) Palmieri
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-08 21:29 EST by Jon Smirl
Modified: 2013-03-13 00:47 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-05 11:58:40 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
esound patch (1.90 KB, patch)
2005-02-10 05:51 EST, John Haxby
no flags Details | Diff

  None (edit)
Description Jon Smirl 2005-02-08 21:29:46 EST
This patch fixes a problem I have with garbled sound from esd and Alsa
USB audio.

From: Takashi Iwai <tiwai@suse.de>

--- audio_alsa09.c-dist 2005-01-26 20:08:38.477465576 +0100
+++ audio_alsa09.c      2005-01-26 20:34:42.981624792 +0100
@@ -444,45 +444,37 @@
int esd_audio_write( void *buffer, int buf_size )
{
       int err;
-
       int len = snd_pcm_bytes_to_frames(alsa_playback_handle, buf_size);
-       while ( ( err = snd_pcm_writei( alsa_playback_handle, buffer,
len)) < 0) {
-               if (alsadbg) {
-                       fprintf(stderr, "esd_audio_write\n");
-                       print_state();
-               }

-               if (err == -EPIPE) {
-                       if (alsadbg)
-                               fprintf(stderr, "EPIPE\n");
-                       if (( err = snd_pcm_prepare(
alsa_playback_handle ) )< 0) {
-                               if (alsadbg)
-                                       fprintf(stderr, "%s\n",
snd_strerror(err));
-                               return -1;
+       while (len > 0) {
+               while ( ( err = snd_pcm_writei( alsa_playback_handle,
buffer, len)) < 0) {
+                       if (alsadbg) {
+                               fprintf(stderr, "esd_audio_write\n");
+                               print_state();
                       }
-                       continue;
-               } else  if (err == -ESTRPIPE) {
-                       if (alsadbg)
-                               fprintf(stderr, "ESTRPIPE\n");
-                       while (( err =
snd_pcm_resume(alsa_playback_handle)) == -EAGAIN)
-                               sleep(1);
+
+                       if (err == -EPIPE) {
+                               if (alsadbg)
+                                       fprintf(stderr, "EPIPE\n");
+                       } else  if (err == -ESTRPIPE) {
+                               if (alsadbg)
+                                       fprintf(stderr, "ESTRPIPE\n");
+                               while (( err =
snd_pcm_resume(alsa_playback_handle)) == -EAGAIN)
+                                       sleep(1);
+                       }
+                       err = snd_pcm_prepare(alsa_playback_handle) ;
                       if (err < 0) {
                               if (alsadbg)
-                                       fprintf(stderr, "Preparing...\n");
-                               if (snd_pcm_prepare(
alsa_playback_handle) < 0)
-                                       return -1;
+                                       fprintf(stderr, "%s\n",
snd_strerror(err));
+                               return -1;
                       }
                       continue;
-               }
-               err = snd_pcm_prepare(alsa_playback_handle) ;
-               if (err < 0) {
-                       if (alsadbg)
-                               fprintf(stderr, "%s\n",
snd_strerror(err));
-                       return -1;
               }
+               len -= err;
+               buffer +=
snd_pcm_frames_to_bytes(alsa_playback_handle, err);
       }

-       return ( snd_pcm_frames_to_bytes(alsa_playback_handle, err) );
+       return buf_size;
}

#define ARCH_esd_audio_flush
Comment 1 John (J5) Palmieri 2005-02-08 23:39:17 EST
Thanks for the patch.  Can you include a changelog entry also or
explain  how the patch fixes the problem?  Is this a backport from an
upstream bug.  If so can you point me to the buzilla entry?  Thanks.
Comment 2 Jon Smirl 2005-02-09 00:11:52 EST
This is all I know:
http://sourceforge.net/mailarchive/forum.php?thread_id=6511507&forum_id=1751

Takashi is a primary developer for alsa.
Comment 3 Jon Smirl 2005-02-09 00:29:49 EST
Related bugs:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146565
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146564

USB Audio did not work out of the box for me. It took several days of
tweaking and patches to make it work. It would be nice to get this
fixed for FC4.

I have a Philips PSC805.  But there are many other USB audio devices. 
http://www.amazon.com/exec/obidos/tg/detail/-/B0000ULADG/qid=1107926573/sr=8-1/ref=sr_8_xs_ap_i1_xgl23/002-9633499-3864004?v=glance&s=electronics&n=507846

I was surprised, sound from PSC805 is actually pretty good.
Comment 4 John Haxby 2005-02-10 05:51:38 EST
Created attachment 110914 [details]
esound patch

The same patch as in the original report, but this time as an attachment for
ease of use.
Comment 5 Matthew Miller 2006-07-10 16:11:03 EDT
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.

Thank you!
Comment 6 petrosyan 2008-02-05 11:58:40 EST
Fedora Core 3 is not maintained anymore.

Setting status to "INSUFFICIENT_DATA". If you can reproduce this bug in the
current Fedora release please reopen this bug and assign it to the corresponding
Fedora version.

Note You need to log in before you can comment on or make changes to this bug.