[PATCH v2 2/6] android/hal-audio: Add resume_endpoint helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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 23eb6b8..992fdf7 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -910,6 +910,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)
 {
@@ -1010,12 +1021,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.2

--
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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux