Disable fast capture for non PCM
The frame count for compressed format record threads is not, in general,
pcm referred and equals the HAL buffer size (because the frame size for
compressed format threads is 1). The capture buffer size in milliseconds
cannot be known in advance for compresed formats because the bitrate of
the compressed stream is not known ahead of time, so disable the fast
path.
Test: media.audio_flinger dumpsys and check RecordThread for e-ac3-joc
does not have fast capture enabled.
Change-Id: Ibbfd9375481679f7a2d92e36ec1ab9a5e6f42b40
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index f46ad16..85e21fd 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -7979,10 +7979,11 @@
break;
case FastCapture_Static:
initFastCapture = !mIsMsdDevice // Disable fast capture for MSD BUS devices.
+ && audio_is_linear_pcm(mFormat)
&& (mFrameCount * 1000) / mSampleRate < kMinNormalCaptureBufferSizeMs;
- ALOGV("%p kUseFastCapture = Static, (%lld * 1000) / %u vs %u, initFastCapture = %d "
- "mIsMsdDevice = %d", this, (long long)mFrameCount, mSampleRate,
- kMinNormalCaptureBufferSizeMs, initFastCapture, mIsMsdDevice);
+ ALOGV("%p kUseFastCapture = Static, format = 0x%x, (%lld * 1000) / %u vs %u, "
+ "initFastCapture = %d, mIsMsdDevice = %d", this, mFormat, (long long)mFrameCount,
+ mSampleRate, kMinNormalCaptureBufferSizeMs, initFastCapture, mIsMsdDevice);
break;
// case FastCapture_Dynamic:
}