[PATCH 7/7] 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 2db927c..aad9925 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -960,6 +960,8 @@ static bool resume_endpoint(struct audio_endpoint *ep)
 	ep->samples = 0;
 	ep->resync = false;
 
+	ep->codec->quality_ctrl(ep->codec_data, QUALITY_CTRL_DEFAULT);
+
 	return true;
 }
 
@@ -1106,6 +1108,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->quality_ctrl(ep->codec_data,
+							QUALITY_CTRL_DECREASE);
 				ep->resync = true;
 			}
 		}
-- 
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




[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