audioflinger: refine latency latency calculation.

There is an audio pipe between the normal mixer output and the fast
mixer to cope for scheduling delays and buffer size difference.
This pipe depth was not taken into account in latency calculation.

Adding the pipe contribution to the latency significantly improves A/V sync.

Bug 6520569.

Change-Id: I5584908e8aa8a02170eb38b22b4370eea800a235
diff --git a/services/audioflinger/MonoPipe.h b/services/audioflinger/MonoPipe.h
index 1f56e54..545d6ac 100644
--- a/services/audioflinger/MonoPipe.h
+++ b/services/audioflinger/MonoPipe.h
@@ -56,6 +56,10 @@
     virtual ssize_t write(const void *buffer, size_t count);
     //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block);
 
+            // average number of frames present in the pipe under normal conditions.
+            // See throttling mechanism in MonoPipe::write()
+            size_t  getAvgFrames() const { return (mMaxFrames * 11) / 16; }
+
 private:
     const size_t    mMaxFrames;     // always a power of 2
     void * const    mBuffer;