Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 330909

Summary: dev-tcltk/snack audio stops on ALSA underflow
Product: Gentoo Linux Reporter: Wade Hampton <wadehamptoniv>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED NEEDINFO    
Severity: normal CC: xmw
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Wade Hampton 2010-08-02 20:52:43 UTC
The unix/jkAudioIO_alsa.c code does not check results of 
calls to snd_pcm_writei().  In SnackAudioWrite() if the ALSA 
driver underflows audio will be stopped but the application 
will still think that audio is playing and the nWritten counter 
will be incorrectly updated.

Recommend:
  n = snd_pcm_writei(...)
  if (n < 0) {
    /* optional write Snack_WriteLogInt("....") */
    snd_pcm_recover(A->handle, n, 1);
    n = 0;
  } else {
    A->nWritten += n;
  }
  return(n);
}

Note there is another snd_pcm_writei() function call
where the result is not checked....
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2010-08-03 03:18:54 UTC
Please post the output of `emerge --info dev-tcltk/snack' too.
Comment 2 Wade Hampton 2010-08-26 19:47:31 UTC
Thanks, but I'm currently not running gentoo so I don't have emerge.  I posted to the gentoo list as you seem to be the only ones supporting this package.

Inspect unix/jkAudioIO_alsa.c and look at the points where snd_pcm_writei() is called.  The return value is not checked. Check the functionality of snd_pcm_writei() and view the notes in:
  http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html