patch to fix a2dp issue

Xu, Martin
2009-04-07T01:32:34Z

Hi:
We have found a2dp issue, that bluez earphone can not work. The issue has filed at:
https://bugzilla.moblin.org/show_bug.cgi?id=1355
(Some one can kindly tell me where I can file the bluez bug. So I can transfer the bug from moblin bugzilla there.)

The root cause is that:
bluez-alsa-plugin has issue at poll revents.
alsa lib needs to poll 2 channel state. But bluez-alsa-plugin only handles
channel1 revent, and leave another one unhandled which leads to the channel's
poll state unpredictable, consequently, pcm stream transfer is broken for the
wront poll state, and bluethooh earphone(a2dp) can not work.
I have worked out a patch to fix the issue, which is listed as below.
BTW:
I found the issue at bluez-4.30 but I find that the latest bluez git tree still has the issue.
I just touch bluez, if something not accurate, please let me know. ;)

diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 9bef89e..1af07b3 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -798,7 +798,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
io->state = SND_PCM_STATE_DISCONNECTED;

*revents = (pfds[0].revents & POLLIN) ? POLLOUT : 0;
-
+ *(revents+1) = (pfds[1].revents & POLLIN) ? POLLOUT : 0;
return 0;
}