Send SBC frames if output buffer is nearly full.

This is to address an A2DP issue seen with the Mazda carkit, where A2DP audio
cannot be played. The MTU size (8200) requested by this carkit is much greater
than the output buffer size (2048) allocated by the Bluez A2DP profile. The
output buffer being full is giving an SBC encode error. This patch checks for
the buffer full condition.

Change-Id: Idded504d085c760baef15cd3cef84fcf57165e4f
Signed-off-by: Yu Kang Ku <kang.ku@motorola.com>
Signed-off-by: Nick Pelly <npelly@google.com>
diff --git a/audio/liba2dp.c b/audio/liba2dp.c
index 7dcfc9d..7403886 100755
--- a/audio/liba2dp.c
+++ b/audio/liba2dp.c
@@ -1160,7 +1160,8 @@
 		data->nsamples += encoded;
 
 		/* No space left for another frame then send */
-		if (data->count + written >= data->link_mtu) {
+		if ((data->count + written >= data->link_mtu) ||
+				(data->count + written >= BUFFER_SIZE)) {
 			VDBG("sending packet %d, count %d, link_mtu %u",
 					data->seq_num, data->count,
 					data->link_mtu);