summaryrefslogtreecommitdiffstats
path: root/audio_a2dp_hw
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-01-08 21:11:45 -0800
committerSteve Kondik <steve@cyngn.com>2016-01-08 21:11:45 -0800
commit80a7a7dc3125e463d06e7215feb3f5a27c4f3352 (patch)
treeb0e0e41e0aa6d4c8da964f168fd1fe5a75ae2b60 /audio_a2dp_hw
parent8c41c59ce1517fc1b32d6f2cee23689453be4870 (diff)
parent67687e5306dda16a919e75b2093c6812f7255d6f (diff)
downloadandroid_system_bt-80a7a7dc3125e463d06e7215feb3f5a27c4f3352.tar.gz
android_system_bt-80a7a7dc3125e463d06e7215feb3f5a27c4f3352.tar.bz2
android_system_bt-80a7a7dc3125e463d06e7215feb3f5a27c4f3352.zip
Merge branch 'LA.BF.1.1.3_rb1.7' of git://codeaurora.org/platform/system/bt into cm-13.0
Change-Id: Ic7851f38b6ca4b82ab9a0b96e7e494849944e5c6
Diffstat (limited to 'audio_a2dp_hw')
-rw-r--r--audio_a2dp_hw/audio_a2dp_hw.c58
-rw-r--r--audio_a2dp_hw/audio_a2dp_hw.h2
2 files changed, 58 insertions, 2 deletions
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c
index f8a9a7238..1933d5a75 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.c
+++ b/audio_a2dp_hw/audio_a2dp_hw.c
@@ -545,6 +545,7 @@ static int start_audio_datapath(struct a2dp_stream_common *common)
return -1;
}
+#ifndef BTA_AV_SPLIT_A2DP_ENABLED
/* connect socket if not yet connected */
if (common->audio_fd == AUDIO_SKT_DISCONNECTED)
{
@@ -557,6 +558,9 @@ static int start_audio_datapath(struct a2dp_stream_common *common)
common->state = AUDIO_A2DP_STATE_STARTED;
}
+#else
+ common->state = AUDIO_A2DP_STATE_STARTED;
+#endif
return 0;
}
@@ -583,9 +587,11 @@ static int stop_audio_datapath(struct a2dp_stream_common *common)
common->state = AUDIO_A2DP_STATE_STOPPED;
+#ifndef BTA_AV_SPLIT_A2DP_ENABLED
/* disconnect audio path */
skt_disconnect(common->audio_fd);
common->audio_fd = AUDIO_SKT_DISCONNECTED;
+#endif
return 0;
}
@@ -608,10 +614,12 @@ static int suspend_audio_datapath(struct a2dp_stream_common *common, bool standb
else
common->state = AUDIO_A2DP_STATE_SUSPENDED;
+#ifndef BTA_AV_SPLIT_A2DP_ENABLED
/* disconnect audio path */
skt_disconnect(common->audio_fd);
common->audio_fd = AUDIO_SKT_DISCONNECTED;
+#endif
return 0;
}
@@ -720,6 +728,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
}
DEBUG("wrote %d bytes out of %zu bytes", sent, bytes);
+
return sent;
}
@@ -820,13 +829,60 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
int retval;
int status = 0;
- INFO("state %d", out->common.state);
+ INFO("out_set_parameters: state %d", out->common.state);
parms = str_parms_create_str(kvpairs);
/* dump params */
str_parms_dump(parms);
+#ifdef BTA_AV_SPLIT_A2DP_ENABLED
+ retval = str_parms_get_str(parms, "A2dpStarted", keyval, sizeof(keyval));
+ if (retval >= 0)
+ {
+ INFO("out_set_parameters, param: A2dpStarted");
+ if (strcmp(keyval, "true") == 0)
+ {
+ INFO("out_set_parameters, value: true");
+ pthread_mutex_lock(&out->common.lock);
+ if (out->common.state == AUDIO_A2DP_STATE_SUSPENDED)
+ {
+ INFO("stream suspended");
+ status = -1;
+ }
+ else if ((out->common.state == AUDIO_A2DP_STATE_STOPPED) ||
+ (out->common.state == AUDIO_A2DP_STATE_STANDBY))
+ {
+ if (start_audio_datapath(&out->common) < 0)
+ {
+ INFO("stream start failed");
+ status = -1;
+ }
+ }
+ else if (out->common.state != AUDIO_A2DP_STATE_STARTED)
+ {
+ ERROR("stream not in stopped or standby");
+ status = -1;
+ }
+ pthread_mutex_unlock(&out->common.lock);
+ INFO("stream start completes with status: %d", status);
+ }
+ else if (strcmp(keyval, "false") == 0)
+ {
+ INFO("out_set_parameters, value: false");
+ pthread_mutex_lock(&out->common.lock);
+ if (out->common.state != AUDIO_A2DP_STATE_SUSPENDED)
+ status = suspend_audio_datapath(&out->common, true);
+ else
+ {
+ ERROR("stream alreday suspended");
+ }
+ pthread_mutex_unlock(&out->common.lock);
+ INFO("stream stop completes with status: %d", status);
+ }
+ }
+#endif
+
retval = str_parms_get_str(parms, "closing", keyval, sizeof(keyval));
if (retval >= 0)
diff --git a/audio_a2dp_hw/audio_a2dp_hw.h b/audio_a2dp_hw/audio_a2dp_hw.h
index f4e5a1a03..eaade32b3 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.h
+++ b/audio_a2dp_hw/audio_a2dp_hw.h
@@ -36,7 +36,7 @@
#define A2DP_CTRL_PATH "/data/misc/bluedroid/.a2dp_ctrl"
#define A2DP_DATA_PATH "/data/misc/bluedroid/.a2dp_data"
-#ifdef SAMPLE_RATE_48K
+#if defined(SAMPLE_RATE_48K) || defined(BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ)
#define AUDIO_STREAM_DEFAULT_RATE 48000
#else
#define AUDIO_STREAM_DEFAULT_RATE 44100