Rename symbols to be more consistent
Bug: 37153050
Test: builds OK
Change-Id: I7e55a03ca8e1f22901db6c8f6f2ad32e4c95a0cd
diff --git a/services/audioflinger/FastCapture.cpp b/services/audioflinger/FastCapture.cpp
index 873a9ad..d063772 100644
--- a/services/audioflinger/FastCapture.cpp
+++ b/services/audioflinger/FastCapture.cpp
@@ -57,7 +57,7 @@
return mSQ.poll();
}
-void FastCapture::setLog(NBLog::Writer *logWriter __unused)
+void FastCapture::setNBLogWriter(NBLog::Writer *logWriter __unused)
{
}
diff --git a/services/audioflinger/FastCapture.h b/services/audioflinger/FastCapture.h
index e258a4d..c3817c0 100644
--- a/services/audioflinger/FastCapture.h
+++ b/services/audioflinger/FastCapture.h
@@ -39,7 +39,7 @@
// callouts
virtual const FastThreadState *poll();
- virtual void setLog(NBLog::Writer *logWriter);
+ virtual void setNBLogWriter(NBLog::Writer *logWriter);
virtual void onIdle();
virtual void onExit();
virtual bool isSubClassCommand(FastThreadState::Command command);
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index 103e7f8..b4502b2 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -101,10 +101,12 @@
return mSQ.poll();
}
-void FastMixer::setLog(NBLog::Writer *logWriter)
+void FastMixer::setNBLogWriter(NBLog::Writer *logWriter)
{
+ // FIXME If mMixer is set or changed prior to this, we don't inform correctly.
+ // Should cache logWriter and re-apply it at the assignment to mMixer.
if (mMixer != NULL) {
- mMixer->setLog(logWriter);
+ mMixer->setNBLogWriter(logWriter);
}
}
@@ -188,6 +190,7 @@
// implementation; it would be better to have normal mixer allocate for us
// to avoid blocking here and to prevent possible priority inversion
mMixer = new AudioMixer(frameCount, mSampleRate, FastMixerState::sMaxFastTracks);
+ // FIXME See the other FIXME at FastMixer::setNBLogWriter()
const size_t mixerFrameSize = mSinkChannelCount
* audio_bytes_per_sample(mMixerBufferFormat);
mMixerBufferSize = mixerFrameSize * frameCount;
diff --git a/services/audioflinger/FastMixer.h b/services/audioflinger/FastMixer.h
index bdfd8a0..930fa8d 100644
--- a/services/audioflinger/FastMixer.h
+++ b/services/audioflinger/FastMixer.h
@@ -46,7 +46,7 @@
// callouts
virtual const FastThreadState *poll();
- virtual void setLog(NBLog::Writer *logWriter);
+ virtual void setNBLogWriter(NBLog::Writer *logWriter);
virtual void onIdle();
virtual void onExit();
virtual bool isSubClassCommand(FastThreadState::Command command);
diff --git a/services/audioflinger/FastThread.cpp b/services/audioflinger/FastThread.cpp
index cf9fce3..a0bf63b 100644
--- a/services/audioflinger/FastThread.cpp
+++ b/services/audioflinger/FastThread.cpp
@@ -27,6 +27,7 @@
#include <utils/Trace.h>
#include "FastThread.h"
#include "FastThreadDumpState.h"
+#include "TypedLogger.h"
#define FAST_DEFAULT_NS 999999999L // ~1 sec: default time to sleep
#define FAST_HOT_IDLE_NS 1000000L // 1 ms: time to sleep while hot idling
@@ -64,8 +65,8 @@
/* mMeasuredWarmupTs({0, 0}), */
mWarmupCycles(0),
mWarmupConsecutiveInRangeCycles(0),
- // mDummyLogWriter
- mLogWriter(&mDummyLogWriter),
+ // mDummyNBLogWriter
+ mNBLogWriter(&mDummyNBLogWriter),
mTimestampStatus(INVALID_OPERATION),
mCommand(FastThreadState::INITIAL),
@@ -119,8 +120,9 @@
// As soon as possible of learning of a new dump area, start using it
mDumpState = next->mDumpState != NULL ? next->mDumpState : mDummyDumpState;
- mLogWriter = next->mNBLogWriter != NULL ? next->mNBLogWriter : &mDummyLogWriter;
- setLog(mLogWriter);
+ mNBLogWriter = next->mNBLogWriter != NULL ? next->mNBLogWriter : &mDummyNBLogWriter;
+ setNBLogWriter(mNBLogWriter); // FastMixer informs its AudioMixer, FastCapture ignores
+ logWriterTLS = mNBLogWriter;
// We want to always have a valid reference to the previous (non-idle) state.
// However, the state queue only guarantees access to current and previous states.
@@ -218,7 +220,6 @@
struct timespec newTs;
int rc = clock_gettime(CLOCK_MONOTONIC, &newTs);
if (rc == 0) {
- //mLogWriter->logTimestamp(newTs);
if (mOldTsValid) {
time_t sec = newTs.tv_sec - mOldTs.tv_sec;
long nsec = newTs.tv_nsec - mOldTs.tv_nsec;
diff --git a/services/audioflinger/FastThread.h b/services/audioflinger/FastThread.h
index 816b666..2a71414 100644
--- a/services/audioflinger/FastThread.h
+++ b/services/audioflinger/FastThread.h
@@ -41,7 +41,7 @@
// callouts to subclass in same lexical order as they were in original FastMixer.cpp
// FIXME need comments
virtual const FastThreadState *poll() = 0;
- virtual void setLog(NBLog::Writer *logWriter __unused) { }
+ virtual void setNBLogWriter(NBLog::Writer *logWriter __unused) { }
virtual void onIdle() = 0;
virtual void onExit() = 0;
virtual bool isSubClassCommand(FastThreadState::Command command) = 0;
@@ -81,8 +81,8 @@
struct timespec mMeasuredWarmupTs; // how long did it take for warmup to complete
uint32_t mWarmupCycles; // counter of number of loop cycles during warmup phase
uint32_t mWarmupConsecutiveInRangeCycles; // number of consecutive cycles in range
- NBLog::Writer mDummyLogWriter;
- NBLog::Writer* mLogWriter;
+ NBLog::Writer mDummyNBLogWriter;
+ NBLog::Writer* mNBLogWriter; // always non-nullptr: real NBLog::Writer* or &mDummyNBLogWriter
status_t mTimestampStatus;
FastThreadState::Command mCommand;
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 6a75bb0..7f7e353 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2930,6 +2930,7 @@
bool AudioFlinger::PlaybackThread::threadLoop()
{
+ // FIXME Make this an API
logWriterTLS = mNBLogWriter.get();
Vector< sp<Track> > tracksToRemove;
@@ -2983,6 +2984,7 @@
processConfigEvents_l();
if (logString != NULL) {
+ // FIXME Remove these internal APIs and replace by LOGT
mNBLogWriter->logTimestamp();
mNBLogWriter->log(logString);
logString = NULL;