--- android/hal-audio.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/android/hal-audio.c b/android/hal-audio.c index 2f28b13..558331a 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -901,6 +901,17 @@ static void close_endpoint(struct audio_endpoint *ep) ep->codec_data = NULL; } +static bool resume_endpoint(struct audio_endpoint *ep) +{ + if (ipc_resume_stream_cmd(ep->id) != AUDIO_STATUS_SUCCESS) + return false; + + clock_gettime(CLOCK_MONOTONIC, &ep->start); + ep->samples = 0; + + return true; +} + static void downmix_to_mono(struct a2dp_stream_out *out, const uint8_t *buffer, size_t bytes) { @@ -1001,12 +1012,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, if (out->audio_state == AUDIO_A2DP_STATE_STANDBY) { DBG("stream in standby, auto-start"); - if (ipc_resume_stream_cmd(out->ep->id) != AUDIO_STATUS_SUCCESS) + if (!resume_endpoint(out->ep)) return -1; - clock_gettime(CLOCK_MONOTONIC, &out->ep->start); - out->ep->samples = 0; - out->audio_state = AUDIO_A2DP_STATE_STARTED; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html