summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Pelly <>2009-04-10 16:41:57 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-10 16:41:57 -0700
commitb53e009e357e1a41383796112ad6cbd7d6b89d9d (patch)
treef814907d0116f9a0770eb6615167b577846c3907
parentca75519d782909d11c032fc5e295622f0aa2e6c8 (diff)
downloadbluez-b53e009e357e1a41383796112ad6cbd7d6b89d9d.tar.gz
AI 145785: Don't close the A2DP data socket on data error - prevents mediaserver from wedging on A2DP device poweroff.android-sdk-1.5_r3android-sdk-1.5_r1android-1.5r4android-1.5r3android-1.5r2android-1.5cupcake-releasecupcake
This prevents a race that occurs when an A2DP headset is powered down. If the data socket closes itself then mediaserver tries to recover the stream, while the control path in hcid tries to cleanup the disconnected stream. hcid cant handle this and wedges mediaserver. Instead let the control path code trigger all the cleanup (including eventually closing the data socket through bluetooth_close() or bluetooth_stop()). BUG=1774568 Automated import of CL 145785
-rw-r--r--utils/audio/liba2dp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/utils/audio/liba2dp.c b/utils/audio/liba2dp.c
index 01c08c2b..7960b12c 100644
--- a/utils/audio/liba2dp.c
+++ b/utils/audio/liba2dp.c
@@ -613,17 +613,13 @@ static int avdtp_write(struct bluetooth_data *data)
print_time("send", begin2, end2);
#endif
if (ret < 0) {
- ERR("send returned %d errno %s.", ret, strerror(errno));
- ret = -errno;
+ /* can happen during normal remote disconnect */
+ VDBG("send() failed: %d (errno %s)", ret, strerror(errno));
}
} else {
- ret = -errno;
- ERR("poll failed: %d", ret);
- }
-
- if (ret < 0) {
- close(data->stream.fd);
- data->stream.fd = -1;
+ /* can happen during normal remote disconnect */
+ VDBG("poll() failed: %d (revents = %d, errno %s)",
+ ret, data->stream.revents, strerror(errno));
}
/* Reset buffer of data to send */
@@ -636,7 +632,7 @@ static int avdtp_write(struct bluetooth_data *data)
end = get_microseconds();
print_time("avdtp_write", begin, end);
#endif
- return ret;
+ return 0; /* always return success */
}
static int audioservice_send(struct bluetooth_data *data,