A few months ago we'd digged jackd code in #alsa IRC trying to find why itfails with
"ALSA: could not start playback (File descriptor in bad state)"when run on top
"type bluetooth" pcm. The reason was in a single line (both in
jack1/drivers/alsa/alsa_driver.cand jack2/linux/alsa/alsa_driver.c): if ((err =
snd_pcm_start (driver->playback_handle)) < 0) {which always fails after
snd_pcm_mmap_commit() filling the buffer,because pcm's already in RUNNING state and
can't be started again:>
http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html> For playback, if samples in
ring buffer is equal or greater than> the start threshold parameters and the stream
is not running,> the stream will be started automaticallyThe following small patch
fixes it for both jack1 and jack2:--- alsa_driver.c+++
alsa_driver.c @@ -1055,7
+1055,8 @@ alsa_driver_start (alsa_driver_t
*driver
driver->user_nperiods
*
driver->frames_per_cycle);
-
if ((err = snd_pcm_start (driver->playback_handle)) < 0)
{+
if (snd_pcm_state(driver->playback_handle) !=
SND_PCM_STATE_RUNNING+
&& (err = snd_pcm_start (driver->playback_handle)) < 0)
{
jack_error ("ALSA: could not start playback
(%s)",
snd_strerror
(err));
return -1;