From c63a16d1567e4342ed4d660467dfd74a6e4aeb02 Mon Sep 17 00:00:00 2001 From: Andrzej Kaczmarek Date: Thu, 17 Apr 2014 01:50:38 +0200 Subject: [PATCH] android/hal-audio: Adjust audio quality automatically 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 chance 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 8bfde7c89..c4bd4feda 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; } } -- 2.47.3