Reduce logging for a cleaner logcat
Convert a few LOGDs to LOGW
diff --git a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
index ee98132..0026610 100644
--- a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
+++ b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
@@ -89,10 +89,8 @@
}
void ActivityContext::close(int32_t streamIndex) {
- LOGD("ActivityContext::%s() called for stream %d ", __func__, streamIndex);
stopBlockingIOThread();
oboe::AudioStream *oboeStream = getStream(streamIndex);
- LOGD("ActivityContext::%s() close stream %p ", __func__, oboeStream);
if (oboeStream != nullptr) {
oboeStream->close();
LOGD("ActivityContext::%s() delete stream %d ", __func__, streamIndex);
@@ -108,7 +106,6 @@
}
oboe::Result ActivityContext::pause() {
- LOGD("ActivityContext::%s() called", __func__);
oboe::Result result = oboe::Result::OK;
stopBlockingIOThread();
for (auto entry : mOboeStreams) {
@@ -122,10 +119,7 @@
oboe::Result ActivityContext::stopAllStreams() {
oboe::Result result = oboe::Result::OK;
stopBlockingIOThread();
- LOGD("ActivityContext::stopAllStreams() called");
for (auto entry : mOboeStreams) {
- LOGD("ActivityContext::stopAllStreams() handle = %d, stream %p",
- entry.first, entry.second.get());
oboe::AudioStream *oboeStream = entry.second.get();
result = oboeStream->requestStop();
printScheduler();
@@ -208,8 +202,6 @@
// Open a stream based on the builder settings.
std::shared_ptr<oboe::AudioStream> oboeStream;
Result result = builder.openStream(oboeStream);
- LOGD("ActivityContext::open() builder.openStream() returned %d, oboeStream = %p",
- result, oboeStream.get());
AAudioExtensions::getInstance().setMMapEnabled(oldMMapEnabled);
if (result != Result::OK) {
freeStreamIndex(streamIndex);
@@ -235,7 +227,6 @@
}
oboe::Result ActivityContext::start() {
- LOGD("ActivityContext: %s() called", __func__);
oboe::Result result = oboe::Result::OK;
oboe::AudioStream *inputStream = getInputStream();
oboe::AudioStream *outputStream = getOutputStream();
@@ -249,7 +240,6 @@
result = startStreams();
if (!mUseCallback && result == oboe::Result::OK) {
- LOGD("start thread for blocking I/O");
// Instead of using the callback, start a thread that writes the stream.
threadEnabled.store(true);
dataThread = new std::thread(threadCallback, this);
@@ -467,7 +457,6 @@
}
oboe::Result ActivityRecording::stopPlayback() {
- LOGD("ActivityRecording::%s() called", __func__);
oboe::Result result = oboe::Result::OK;
if (playbackStream != nullptr) {
result = playbackStream->requestStop();
@@ -481,7 +470,6 @@
oboe::Result ActivityRecording::startPlayback() {
stop();
- LOGD("ActivityRecording::%s() called, mSampleRate = %d", __func__, mSampleRate);
oboe::AudioStreamBuilder builder;
builder.setChannelCount(mChannelCount)
->setSampleRate(mSampleRate)
@@ -489,7 +477,6 @@
->setCallback(&mPlayRecordingCallback)
->setAudioApi(oboe::AudioApi::OpenSLES);
oboe::Result result = builder.openStream(&playbackStream);
- LOGD("ActivityRecording::%s() openStream() returned %d", __func__, result);
if (result != oboe::Result::OK) {
delete playbackStream;
playbackStream = nullptr;
@@ -604,7 +591,6 @@
// =================================================================== ActivityTestDisconnect
void ActivityTestDisconnect::close(int32_t streamIndex) {
- LOGD("ActivityTestDisconnect::%s() called for stream %d ", __func__, streamIndex);
ActivityContext::close(streamIndex);
mSinkFloat.reset();
}
diff --git a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h
index b86d50a..ed989cd 100644
--- a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h
+++ b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.h
@@ -245,7 +245,6 @@
}
void setWorkload(double workload) {
- LOGD("ActivityContext::%s(%f)", __func__, workload);
oboeCallbackProxy.setWorkload(workload);
}
@@ -260,9 +259,7 @@
virtual void runBlockingIO() {};
static void threadCallback(ActivityContext *context) {
- LOGD("%s: called", __func__);
context->runBlockingIO();
- LOGD("%s: exiting", __func__);
}
void stopBlockingIOThread() {
@@ -654,7 +651,6 @@
};
void setActivityType(int activityType) {
- LOGD("%s(%d)", __func__, activityType);
mActivityType = (ActivityType) activityType;
switch(mActivityType) {
default:
diff --git a/include/oboe/AudioStream.h b/include/oboe/AudioStream.h
index faee05b..a158aaf 100644
--- a/include/oboe/AudioStream.h
+++ b/include/oboe/AudioStream.h
@@ -517,6 +517,8 @@
private:
+ // Log the scheduler if it changes.
+ void checkScheduler();
int mPreviousScheduler = -1;
std::atomic<bool> mDataCallbackEnabled{false};
diff --git a/src/aaudio/AudioStreamAAudio.cpp b/src/aaudio/AudioStreamAAudio.cpp
index 383e9f6..52d85b9 100644
--- a/src/aaudio/AudioStreamAAudio.cpp
+++ b/src/aaudio/AudioStreamAAudio.cpp
@@ -79,10 +79,8 @@
// Prevents deletion of the stream if the app is using AudioStreamBuilder::openSharedStream()
static void oboe_aaudio_error_thread_proc_shared(std::shared_ptr<AudioStream> sharedStream,
Result error) {
- LOGD("%s() - entering >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", __func__);
AudioStreamAAudio *oboeStream = reinterpret_cast<AudioStreamAAudio*>(sharedStream.get());
oboe_aaudio_error_thread_proc(oboeStream, error);
- LOGD("%s() - exiting <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", __func__);
}
namespace oboe {
@@ -94,7 +92,6 @@
: AudioStream(builder)
, mAAudioStream(nullptr) {
mCallbackThreadEnabled.store(false);
- LOGD("AudioStreamAAudio() call isSupported()");
isSupported();
}
@@ -121,7 +118,7 @@
if (oboeStream->wasErrorCallbackCalled()) { // block extra error callbacks
LOGE("%s() multiple error callbacks called!", __func__);
} else if (stream != oboeStream->getUnderlyingStream()) {
- LOGD("%s() stream already closed", __func__); // can happen if there are bugs
+ LOGW("%s() stream already closed", __func__); // can happen if there are bugs
} else if (sharedStream) {
// Handle error on a separate thread using shared pointer.
std::thread t(oboe_aaudio_error_thread_proc_shared, sharedStream,
@@ -273,15 +270,14 @@
mSessionId = SessionId::None;
}
- LOGD("AudioStreamAAudio.open() app format = %d", static_cast<int>(mFormat));
- LOGD("AudioStreamAAudio.open() sample rate = %d", static_cast<int>(mSampleRate));
- LOGD("AudioStreamAAudio.open() capacity = %d", static_cast<int>(mBufferCapacityInFrames));
+ LOGD("AudioStreamAAudio.open() format=%d, sampleRate=%d, capacity = %d",
+ static_cast<int>(mFormat), static_cast<int>(mSampleRate),
+ static_cast<int>(mBufferCapacityInFrames));
error2:
mLibLoader->builder_delete(aaudioBuilder);
- LOGD("AudioStreamAAudio.open: AAudioStream_Open() returned %s, mAAudioStream = %p",
- mLibLoader->convertResultToText(static_cast<aaudio_result_t>(result)),
- mAAudioStream.load());
+ LOGD("AudioStreamAAudio.open: AAudioStream_Open() returned %s",
+ mLibLoader->convertResultToText(static_cast<aaudio_result_t>(result)));
return result;
}
@@ -311,7 +307,7 @@
return result;
} else {
if (result == DataCallbackResult::Stop) {
- LOGE("Oboe callback returned DataCallbackResult::Stop");
+ LOGD("Oboe callback returned DataCallbackResult::Stop");
} else {
LOGE("Oboe callback returned unexpected value = %d", result);
}
diff --git a/src/common/AudioStream.cpp b/src/common/AudioStream.cpp
index f0fd2f2..b1bbbbd 100644
--- a/src/common/AudioStream.cpp
+++ b/src/common/AudioStream.cpp
@@ -39,22 +39,24 @@
return Result::OK;
}
-DataCallbackResult AudioStream::fireDataCallback(void *audioData, int32_t numFrames) {
- if (!isDataCallbackEnabled()) {
- LOGW("AudioStream::%s() called with data callback disabled!", __func__);
- return DataCallbackResult::Stop; // We should not be getting called any more.
- }
-
- // TODO remove
+// Call this from fireDataCallback to monitor CPU scheduler.
+void AudioStream::checkScheduler() {
int scheduler = sched_getscheduler(0) & ~SCHED_RESET_ON_FORK; // for current thread
if (scheduler != mPreviousScheduler) {
LOGD("AudioStream::%s() scheduler = %s", __func__,
((scheduler == SCHED_FIFO) ? "SCHED_FIFO" :
- ((scheduler == SCHED_OTHER) ? "SCHED_OTHER" :
- ((scheduler == SCHED_RR) ? "SCHED_RR" : "UNKNOWN")))
+ ((scheduler == SCHED_OTHER) ? "SCHED_OTHER" :
+ ((scheduler == SCHED_RR) ? "SCHED_RR" : "UNKNOWN")))
);
mPreviousScheduler = scheduler;
}
+}
+
+DataCallbackResult AudioStream::fireDataCallback(void *audioData, int32_t numFrames) {
+ if (!isDataCallbackEnabled()) {
+ LOGW("AudioStream::%s() called with data callback disabled!", __func__);
+ return DataCallbackResult::Stop; // We should not be getting called any more.
+ }
DataCallbackResult result;
if (mStreamCallback == nullptr) {
@@ -195,11 +197,9 @@
}
static void oboe_stop_thread_proc(AudioStream *oboeStream) {
- LOGD("%s() called ----)))))", __func__);
if (oboeStream != nullptr) {
oboeStream->requestStop();
}
- LOGD("%s() returning (((((----", __func__);
}
void AudioStream::launchStopThread() {
diff --git a/src/common/AudioStreamBuilder.cpp b/src/common/AudioStreamBuilder.cpp
index 48be1b7..9f1e31b 100644
--- a/src/common/AudioStreamBuilder.cpp
+++ b/src/common/AudioStreamBuilder.cpp
@@ -128,7 +128,7 @@
}
// Use childStream in a FilterAudioStream.
- LOGD("%s() create a FilterAudioStream for data conversion.", __func__);
+ LOGI("%s() create a FilterAudioStream for data conversion.", __func__);
FilterAudioStream *filterStream = new FilterAudioStream(parentBuilder, tempStream);
result = filterStream->configureFlowGraph();
if (result != Result::OK) {
diff --git a/src/common/DataConversionFlowGraph.cpp b/src/common/DataConversionFlowGraph.cpp
index ce1d093..c15e92d 100644
--- a/src/common/DataConversionFlowGraph.cpp
+++ b/src/common/DataConversionFlowGraph.cpp
@@ -86,7 +86,7 @@
int32_t sinkChannelCount = sinkStream->getChannelCount();
int32_t sinkSampleRate = sinkStream->getSampleRate();
- LOGD("%s() flowgraph converts channels: %d to %d, format: %d to %d, rate: %d to %d, qual = %d",
+ LOGI("%s() flowgraph converts channels: %d to %d, format: %d to %d, rate: %d to %d, qual = %d",
__func__,
sourceChannelCount, sinkChannelCount,
sourceFormat, sinkFormat,
diff --git a/src/fifo/FifoBuffer.cpp b/src/fifo/FifoBuffer.cpp
index f89dca6..8d6b03b 100644
--- a/src/fifo/FifoBuffer.cpp
+++ b/src/fifo/FifoBuffer.cpp
@@ -40,8 +40,6 @@
int32_t bytesPerBuffer = bytesPerFrame * capacityInFrames;
mStorage = new uint8_t[bytesPerBuffer];
mStorageOwned = true;
- LOGD("%s() capacityInFrames = %d, bytesPerFrame = %d",
- __func__, capacityInFrames, bytesPerFrame);
}
FifoBuffer::FifoBuffer( uint32_t bytesPerFrame,
@@ -60,8 +58,6 @@
writeCounterAddress);
mStorage = dataStorageAddress;
mStorageOwned = false;
- LOGD("%s(*) capacityInFrames = %d, bytesPerFrame = %d",
- __func__, capacityInFrames, bytesPerFrame);
}
FifoBuffer::~FifoBuffer() {
diff --git a/src/opensles/AudioInputStreamOpenSLES.cpp b/src/opensles/AudioInputStreamOpenSLES.cpp
index 9fad5b1..fcad183 100644
--- a/src/opensles/AudioInputStreamOpenSLES.cpp
+++ b/src/opensles/AudioInputStreamOpenSLES.cpp
@@ -340,7 +340,7 @@
SLmillisecond msec = 0;
SLresult slResult = (*mRecordInterface)->GetPosition(mRecordInterface, &msec);
if (SL_RESULT_SUCCESS != slResult) {
- LOGD("%s(): GetPosition() returned %s", __func__, getSLErrStr(slResult));
+ LOGW("%s(): GetPosition() returned %s", __func__, getSLErrStr(slResult));
// set result based on SLresult
result = Result::ErrorInternal;
} else {
diff --git a/src/opensles/AudioOutputStreamOpenSLES.cpp b/src/opensles/AudioOutputStreamOpenSLES.cpp
index 4ca7452..cdb8883 100644
--- a/src/opensles/AudioOutputStreamOpenSLES.cpp
+++ b/src/opensles/AudioOutputStreamOpenSLES.cpp
@@ -271,7 +271,7 @@
SLresult slResult = (*mPlayInterface)->SetPlayState(mPlayInterface, newState);
if (SL_RESULT_SUCCESS != slResult) {
- LOGD("AudioOutputStreamOpenSLES(): %s() returned %s", __func__, getSLErrStr(slResult));
+ LOGW("AudioOutputStreamOpenSLES(): %s() returned %s", __func__, getSLErrStr(slResult));
result = Result::ErrorInternal; // TODO convert slResult to Result::Error
}
return result;
@@ -312,7 +312,6 @@
setState(initialState);
mLock.unlock();
}
- LOGD("AudioOutputStreamOpenSLES(): %s() returning %d", __func__, result);
return result;
}
@@ -343,7 +342,6 @@
} else {
setState(initialState);
}
- LOGD("AudioOutputStreamOpenSLES(): %s() returning %d", __func__, result);
return result;
}
@@ -371,7 +369,6 @@
result = Result::ErrorInternal;
}
}
- LOGD("AudioOutputStreamOpenSLES(): %s() returning %d", __func__, result);
return result;
}
@@ -410,7 +407,6 @@
} else {
setState(initialState);
}
- LOGD("AudioOutputStreamOpenSLES(): %s() returning %d", __func__, result);
return result;
}
@@ -440,7 +436,7 @@
SLmillisecond msec = 0;
SLresult slResult = (*mPlayInterface)->GetPosition(mPlayInterface, &msec);
if (SL_RESULT_SUCCESS != slResult) {
- LOGD("%s(): GetPosition() returned %s", __func__, getSLErrStr(slResult));
+ LOGW("%s(): GetPosition() returned %s", __func__, getSLErrStr(slResult));
// set result based on SLresult
result = Result::ErrorInternal;
} else {
diff --git a/src/opensles/AudioStreamOpenSLES.cpp b/src/opensles/AudioStreamOpenSLES.cpp
index d4990ba..3af1a30 100644
--- a/src/opensles/AudioStreamOpenSLES.cpp
+++ b/src/opensles/AudioStreamOpenSLES.cpp
@@ -69,8 +69,7 @@
Result AudioStreamOpenSLES::open() {
- LOGI("AudioStreamOpenSLES::open(chans:%d, rate:%d)",
- mChannelCount, mSampleRate);
+ LOGI("AudioStreamOpenSLES::open() chans=%d, rate=%d", mChannelCount, mSampleRate);
SLresult result = EngineOpenSLES::getInstance().open();
if (SL_RESULT_SUCCESS != result) {