Improve audio logs and dumpsys media.audio_flinger
Include mFrameCount in shared memory corrupt error log.
Fix typo in log for primary audio interface.
Include the new server frame count in logs for fast tracks.
Always log when fast is successful for output tracks, as it helpful
(was already there for input).
Cleanup dumpsys for threads.
Bug: 37153050
Test: builds OK, and logs contain more information
Change-Id: I2b5b4d700e8eb7c261a3125fb03ddc00bf08537e
(cherry picked from commit 1bfe09a0b1755a79abd32b41c0dd433b88fc260c)
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 3b1edec..6a75bb0 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -447,6 +447,8 @@
return "RECORD";
case OFFLOAD:
return "OFFLOAD";
+ case MMAP:
+ return "MMAP";
default:
return "unknown";
}
@@ -533,7 +535,7 @@
{
status_t status = initCheck();
if (status == NO_ERROR) {
- ALOGI("AudioFlinger's thread %p ready to run", this);
+ ALOGI("AudioFlinger's thread %p tid=%d ready to run", this, getTid());
} else {
ALOGE("No working audio driver found.");
}
@@ -809,14 +811,15 @@
char buffer[SIZE];
String8 result;
+ dprintf(fd, "\n%s thread %p, name %s, tid %d, type %d (%s):\n", isOutput() ? "Output" : "Input",
+ this, mThreadName, getTid(), type(), threadTypeToString(type()));
+
bool locked = AudioFlinger::dumpTryLock(mLock);
if (!locked) {
- dprintf(fd, "thread %p may be deadlocked\n", this);
+ dprintf(fd, " Thread may be deadlocked\n");
}
- dprintf(fd, " Thread name: %s\n", mThreadName);
dprintf(fd, " I/O handle: %d\n", mId);
- dprintf(fd, " TID: %d\n", getTid());
dprintf(fd, " Standby: %s\n", mStandby ? "yes" : "no");
dprintf(fd, " Sample rate: %u Hz\n", mSampleRate);
dprintf(fd, " HAL frame count: %zu\n", mFrameCount);
@@ -1778,8 +1781,6 @@
void AudioFlinger::PlaybackThread::dumpInternals(int fd, const Vector<String16>& args)
{
- dprintf(fd, "\nOutput thread %p type %d (%s):\n", this, type(), threadTypeToString(type()));
-
dumpBase(fd, args);
dprintf(fd, " Normal frame count: %zu\n", mNormalFrameCount);
@@ -4714,34 +4715,42 @@
dprintf(fd, " AudioMixer tracks: 0x%08x\n", mAudioMixer->trackNames());
dprintf(fd, " Master mono: %s\n", mMasterMono ? "on" : "off");
- // Make a non-atomic copy of fast mixer dump state so it won't change underneath us
- // while we are dumping it. It may be inconsistent, but it won't mutate!
- // This is a large object so we place it on the heap.
- // FIXME 25972958: Need an intelligent copy constructor that does not touch unused pages.
- const FastMixerDumpState *copy = new FastMixerDumpState(mFastMixerDumpState);
- copy->dump(fd);
- delete copy;
+ if (hasFastMixer()) {
+ dprintf(fd, " FastMixer thread %p tid=%d", mFastMixer.get(), mFastMixer->getTid());
+
+ // Make a non-atomic copy of fast mixer dump state so it won't change underneath us
+ // while we are dumping it. It may be inconsistent, but it won't mutate!
+ // This is a large object so we place it on the heap.
+ // FIXME 25972958: Need an intelligent copy constructor that does not touch unused pages.
+ const FastMixerDumpState *copy = new FastMixerDumpState(mFastMixerDumpState);
+ copy->dump(fd);
+ delete copy;
#ifdef STATE_QUEUE_DUMP
- // Similar for state queue
- StateQueueObserverDump observerCopy = mStateQueueObserverDump;
- observerCopy.dump(fd);
- StateQueueMutatorDump mutatorCopy = mStateQueueMutatorDump;
- mutatorCopy.dump(fd);
+ // Similar for state queue
+ StateQueueObserverDump observerCopy = mStateQueueObserverDump;
+ observerCopy.dump(fd);
+ StateQueueMutatorDump mutatorCopy = mStateQueueMutatorDump;
+ mutatorCopy.dump(fd);
#endif
+#ifdef AUDIO_WATCHDOG
+ if (mAudioWatchdog != 0) {
+ // Make a non-atomic copy of audio watchdog dump so it won't change underneath us
+ AudioWatchdogDump wdCopy = mAudioWatchdogDump;
+ wdCopy.dump(fd);
+ }
+#endif
+
+ } else {
+ dprintf(fd, " No FastMixer\n");
+ }
+
#ifdef TEE_SINK
// Write the tee output to a .wav file
dumpTee(fd, mTeeSource, mId);
#endif
-#ifdef AUDIO_WATCHDOG
- if (mAudioWatchdog != 0) {
- // Make a non-atomic copy of audio watchdog dump so it won't change underneath us
- AudioWatchdogDump wdCopy = mAudioWatchdogDump;
- wdCopy.dump(fd);
- }
-#endif
}
uint32_t AudioFlinger::MixerThread::idleSleepTimeUs() const
@@ -6872,8 +6881,6 @@
void AudioFlinger::RecordThread::dumpInternals(int fd, const Vector<String16>& args)
{
- dprintf(fd, "\nInput thread %p:\n", this);
-
dumpBase(fd, args);
AudioStreamIn *input = mInput;
@@ -8124,8 +8131,6 @@
void AudioFlinger::MmapThread::dumpInternals(int fd, const Vector<String16>& args)
{
- dprintf(fd, "\nMmap thread %p:\n", this);
-
dumpBase(fd, args);
dprintf(fd, " Attributes: content type %d usage %d source %d\n",