[PATCH v2 6/6] android/hal-audio: Adjust audio quality automatically

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

 



In case we go out of sync with audio clock and start skipping data to
catch up, we also decrease audio quality to have better change to avoid
going out of sync in future, i.e. due to poor radio link quality.

Quality is reset to default value on stream resume.
---
 android/hal-audio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/android/hal-audio.c b/android/hal-audio.c
index e25aa07..f60d8cf 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -971,6 +971,8 @@ static bool resume_endpoint(struct audio_endpoint *ep)
 	ep->samples = 0;
 	ep->resync = false;
 
+	ep->codec->update_qos(ep->codec_data, QOS_POLICY_DEFAULT);
+
 	return true;
 }
 
@@ -1117,6 +1119,9 @@ static bool write_data(struct a2dp_stream_out *out, const void *buffer,
 
 			if (diff > MAX_DELAY) {
 				warn("lag is %jums, resyncing", diff / 1000);
+
+				ep->codec->update_qos(ep->codec_data,
+							QOS_POLICY_DECREASE);
 				ep->resync = true;
 			}
 		}
-- 
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