From 6dbb5e3336cfff1ad51d429fcb847307c06efd61 Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Tue, 13 May 2014 10:38:42 -0700 Subject: Use of fast capture by normal capture Will only configure fast capture path if the input buffer size is less than 10 ms and the input sample rate is same as the primary output sample rate. Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397 --- services/audioflinger/Threads.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'services/audioflinger/Threads.h') diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index 8c9943c..07887fb 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -1064,6 +1064,8 @@ public: virtual sp readOnlyHeap() const { return mReadOnlyHeap; } + virtual sp pipeMemory() const { return mPipeMemory; } + sp createRecordTrack_l( const sp& client, uint32_t sampleRate, @@ -1115,7 +1117,7 @@ public: static void syncStartEventCallback(const wp& event); virtual size_t frameCount() const { return mFrameCount; } - bool hasFastCapture() const { return false; } + bool hasFastCapture() const { return mFastCapture != 0; } private: // Enter standby if not already in standby, and set mStandby flag @@ -1145,4 +1147,40 @@ private: const sp mTeeSink; const sp mReadOnlyHeap; + + // one-time initialization, no locks required + sp mFastCapture; // non-0 if there is also a fast capture + // FIXME audio watchdog thread + + // contents are not guaranteed to be consistent, no locks required + FastCaptureDumpState mFastCaptureDumpState; +#ifdef STATE_QUEUE_DUMP + // FIXME StateQueue observer and mutator dump fields +#endif + // FIXME audio watchdog dump + + // accessible only within the threadLoop(), no locks required + // mFastCapture->sq() // for mutating and pushing state + int32_t mFastCaptureFutex; // for cold idle + + // The HAL input source is treated as non-blocking, + // but current implementation is blocking + sp mInputSource; + // The source for the normal capture thread to read from: mInputSource or mPipeSource + sp mNormalSource; + // If a fast capture is present, the non-blocking pipe sink written to by fast capture, + // otherwise clear + sp mPipeSink; + // If a fast capture is present, the non-blocking pipe source read by normal thread, + // otherwise clear + sp mPipeSource; + // Depth of pipe from fast capture to normal thread and fast clients, always power of 2 + size_t mPipeFramesP2; + // If a fast capture is present, the Pipe as IMemory, otherwise clear + sp mPipeMemory; + + static const size_t kFastCaptureLogSize = 4 * 1024; + sp mFastCaptureNBLogWriter; + + bool mFastTrackAvail; // true if fast track available }; -- cgit v1.1