Skip to content

Commit

Permalink
Add enums to some logs (#1979)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertwu1 authored Mar 13, 2024
1 parent 139ca23 commit 70ef948
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/aaudio/AudioStreamAAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ DataCallbackResult AudioStreamAAudio::callOnAudioReady(AAudioStream * /*stream*/
if (result == DataCallbackResult::Stop) {
LOGD("Oboe callback returned DataCallbackResult::Stop");
} else {
LOGE("Oboe callback returned unexpected value = %d", result);
LOGE("Oboe callback returned unexpected value. Error: %d", static_cast<int>(result));
}

// Returning Stop caused various problems before S. See #1230
Expand Down
2 changes: 1 addition & 1 deletion src/common/AudioStreamBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Result AudioStreamBuilder::openStream(AudioStream **streamPP) {
Result AudioStreamBuilder::openStreamInternal(AudioStream **streamPP) {
auto result = isValidConfig();
if (result != Result::OK) {
LOGW("%s() invalid config %d", __func__, result);
LOGW("%s() invalid config. Error %s", __func__, oboe::convertToText(result));
return result;
}

Expand Down
14 changes: 7 additions & 7 deletions src/common/DataConversionFlowGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream
int32_t sinkSampleRate = sinkStream->getSampleRate();
int32_t sinkFramesPerCallback = sinkStream->getFramesPerDataCallback();

LOGI("%s() flowgraph converts channels: %d to %d, format: %d to %d"
", rate: %d to %d, cbsize: %d to %d, qual = %d",
LOGI("%s() flowgraph converts channels: %d to %d, format: %s to %s"
", rate: %d to %d, cbsize: %d to %d, qual = %s",
__func__,
sourceChannelCount, sinkChannelCount,
sourceFormat, sinkFormat,
oboe::convertToText(sourceFormat), oboe::convertToText(sinkFormat),
sourceSampleRate, sinkSampleRate,
sourceFramesPerCallback, sinkFramesPerCallback,
sourceStream->getSampleRateConversionQuality());
oboe::convertToText(sourceStream->getSampleRateConversionQuality()));

// Source
// IF OUTPUT and using a callback then call back to the app using a SourceCaller.
Expand Down Expand Up @@ -128,7 +128,7 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream
actualSourceFramesPerCallback);
break;
default:
LOGE("%s() Unsupported source caller format = %d", __func__, sourceFormat);
LOGE("%s() Unsupported source caller format = %d", __func__, static_cast<int>(sourceFormat));
return Result::ErrorIllegalArgument;
}
mSourceCaller->setStream(sourceStream);
Expand All @@ -150,7 +150,7 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream
mSource = std::make_unique<SourceI32>(sourceChannelCount);
break;
default:
LOGE("%s() Unsupported source format = %d", __func__, sourceFormat);
LOGE("%s() Unsupported source format = %d", __func__, static_cast<int>(sourceFormat));
return Result::ErrorIllegalArgument;
}
if (isInput) {
Expand Down Expand Up @@ -226,7 +226,7 @@ Result DataConversionFlowGraph::configure(AudioStream *sourceStream, AudioStream
mSink = std::make_unique<SinkI32>(sinkChannelCount);
break;
default:
LOGE("%s() Unsupported sink format = %d", __func__, sinkFormat);
LOGE("%s() Unsupported sink format = %d", __func__, static_cast<int>(sinkFormat));
return Result::ErrorIllegalArgument;;
}
lastOutput->connect(&mSink->input);
Expand Down
14 changes: 14 additions & 0 deletions src/common/Utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,20 @@ const char *convertToText<ChannelCount>(ChannelCount channelCount) {
}
}

template<>
const char *convertToText<SampleRateConversionQuality>(SampleRateConversionQuality sampleRateConversionQuality) {

switch (sampleRateConversionQuality) {
case SampleRateConversionQuality::None: return "None";
case SampleRateConversionQuality::Fastest: return "Fastest";
case SampleRateConversionQuality::Low: return "Low";
case SampleRateConversionQuality::Medium: return "Medium";
case SampleRateConversionQuality::High: return "High";
case SampleRateConversionQuality::Best: return "Best";
default: return "Unrecognized sample rate conversion quality";
}
}

std::string getPropertyString(const char * name) {
std::string result;
#ifdef __ANDROID__
Expand Down
2 changes: 1 addition & 1 deletion src/opensles/AudioOutputStreamOpenSLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ Result AudioOutputStreamOpenSLES::requestFlush_l() {
} else {
SLresult slResult = (*mSimpleBufferQueueInterface)->Clear(mSimpleBufferQueueInterface);
if (slResult != SL_RESULT_SUCCESS){
LOGW("Failed to clear buffer queue. OpenSLES error: %d", result);
LOGW("Failed to clear buffer queue. OpenSLES error: %s", getSLErrStr(slResult));
result = Result::ErrorInternal;
}
}
Expand Down

0 comments on commit 70ef948

Please sign in to comment.