[alsa-devel] disconnecting bluetooth device

Thomas Green TGreen2 at Sorenson.com
Tue Oct 14 18:56:25 CEST 2014


I am using gstreamer and bluez-alsa to connect to a Bluetooth headset.  I successfully connect to the device and can play audio from it.  The issue comes when the device disconnects.  Gstreamer lists these alsa errors:

0:00:25.312585875 24605 0x42430800 WARN                    alsa audio/pcm_bluetooth.c:247:playback_hw_thread: alsalib error: poll fd 1 revents 24
0:00:25.313233896 24605    0xd04f0 WARN                    alsa audio/pcm_bluetooth.c:835:bluetooth_playback_poll_revents: alsalib error: read error: Resource temporarily unavailable (11): Resource temporarily unavailable
(lots and lots of these until I terminate the application)

I've looked at the code for pcm_bluetooth.c, headset.c and pcm.c, and from what I can tell  it looks like what is happening is that the playback_hw_thread detects that the device has disconnected and gets a message back with POLLERR | POLLHUP.  In turn, when the bluetooth_playback_poll_revents is called, it can't read any further input.  But the io->state should be getting set to SND_PCM_STATE_DISCONNECTED.  From what I can see, I am guessing that what is happening is that above that is the bluetooth_playback_poll_revents keeps getting called without the io->state being checked to make sure whether or not the state is disconnected.  I haven't dug too deeply into the call stack higher than that, so, I'm not sure.  Is this what is happening, or is there something that I can do myself to mitigate this?  The default alsa installation is 1.0.25, but I've also built libasound 1.0.28, and I still get the same behavior.

Thanks...

Tom




More information about the Alsa-devel mailing list