Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aa0a310 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

audio: Allow higher downstream latency

Increase allowed downstream latency to 5 seconds.

Sometimes software patch might cause >1 second of latency.

Bug: 63901775
Test: MSD prototype
Change-Id: Ie111fa8b87bc7694ef787c6c4b1deca81bda2abb
parent 158ce419
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3220,13 +3220,16 @@ bool AudioFlinger::PlaybackThread::threadLoop()
                }
                if (status == OK) {
                    // verify downstream latency (we assume a max reasonable
                    // latency of 1 second).
                    if (latencyMs >= 0. && latencyMs <= 1000.) {
                    // latency of 5 seconds).
                    const double minLatency = 0., maxLatency = 5000.;
                    if (latencyMs >= minLatency && latencyMs <= maxLatency) {
                        ALOGV("new downstream latency %lf ms", latencyMs);
                        downstreamLatencyStatMs.add(latencyMs);
                    } else {
                        ALOGD("out of range downstream latency %lf ms", latencyMs);
                        if (latencyMs < minLatency) latencyMs = minLatency;
                        else if (latencyMs > maxLatency) latencyMs = maxLatency;
                    }
                    downstreamLatencyStatMs.add(latencyMs);
                }
                mAudioFlinger->mLock.unlock();
            }