Fix RecordThread running too often if fast capture is active

Bug: 30159297
Change-Id: Ieca804450168391c162fc4862398586fcc5d7e4e
diff --git a/media/libnbaio/PipeReader.cpp b/media/libnbaio/PipeReader.cpp
index 799e435..fdea68e 100644
--- a/media/libnbaio/PipeReader.cpp
+++ b/media/libnbaio/PipeReader.cpp
@@ -55,10 +55,9 @@
     // read() is not multi-thread safe w.r.t. itself, so no mutex or atomic op needed to read mFront
     size_t avail = rear - mFront;
     if (CC_UNLIKELY(avail > mPipe.mMaxFrames)) {
-        // Discard 1/16 of the most recent data in pipe to avoid another overrun immediately
-        int32_t oldFront = mFront;
-        mFront = rear - mPipe.mMaxFrames + (mPipe.mMaxFrames >> 4);
-        mFramesOverrun += (size_t) (mFront - oldFront);
+        // Discard all data in pipe to avoid another overrun immediately
+        mFront = rear;
+        mFramesOverrun += avail;
         ++mOverruns;
         return OVERRUN;
     }