Synopsis: Fix a hang issue when playing audio with a2dpd(Bluetooth-alsa)
Overview:
When playing audio using ALSA, and configure ALSA to use a2dpd, after
finish playing one song, then opening the second song will cause hang.
Code actually hangs on snd_pcm_preare which is an ALSA API inside
CAudioOutLinuxAlsa::_Reset().
This snd_pcm_preare call finally routed to a2dp_preare which is inside
a2dpd plugin for ALSA, and it hangs on
while(poll_accept(a2dp->sk,0)){
transfer = recv_socket(a2dp->sk, &GetPointerResp,
sizeof(GetPointerResp));
}
poll_accept always return true which means there is data coming at that
socket, but recv_socket can't recevie anything, and error reports
"Connection reset by peer". So, this becomes an infinite loop.
>From the above investigation, I think when using a2dpd, plugin shouldn't
just discard all writelist and let audio thread exit early, this early
exiting will let approximately 16 packets on writelist be discarded
rather than sent to device. After changing the code and test, it turns
out this is root cause.
This fix will wait inside CAudioOutUnix::_Imp_Reset, to let audio thread
finish writing all data in writelist, and sleep 1 second to let a2dpd
device finish processing data, and then proceed.
Files Added:
Files Modified:
audUnix.cpp (audio/device/platform/unix/audUnix.cpp)
Image Size and Heap Use impact (Client -Only):
little
Platforms and Profiles Affected:
platform: linux-2.2-libc6-gcc32-i586
profile: helix-client-all-defines
Distribution Libraries Affected:
<hxmedplyeng.so>
Distribution library impact and planned action:
<None>
Platforms and Profiles Build Verified:
Set BIF branch -> hxclient_3_1_0_atlas_restricted
Set Target(s) -> player_mid_installer
Set Profile -> helix-client-all-defines
System ID -> linux-2.2-libc6-gcc32-i586
Branch:
HEAD, hxclient_3_1_0_atlas
Copyright assignment: <MUST be one of the following statements >
2. Intel has signed and delivered a Joint Copyright Assignment
to RealNetworks, and received acknowledgment that the
agreement was received.
Files Attached:
a2dpd.diff
Best Regards, Zheng, Huan(ZBT)
OTC/SSD/SSG
Intel Aisa-Pacific Research & Developement Ltd
Tel: 021-6116 6435
Inet: 8821 6435
Cub: 3W035
a2dpd.diff
Description: a2dpd.diff
_______________________________________________ Audio-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/audio-dev
