Improve AudioFlinger error logging
Change-Id: I8ce9aff4038cd7fa0067600faa8080b137db1939
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index b48f23d..d7b31b1 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -395,7 +395,7 @@
int lSessionId;
if (streamType >= AUDIO_STREAM_CNT) {
- LOGE("invalid stream type");
+ LOGE("createTrack() invalid stream type %d", streamType);
lStatus = BAD_VALUE;
goto Exit;
}
@@ -427,6 +427,7 @@
// prevent same audio session on different output threads
uint32_t sessions = t->hasAudioSession(*sessionId);
if (sessions & PlaybackThread::TRACK_SESSION) {
+ LOGE("createTrack() session ID %d already in use", *sessionId);
lStatus = BAD_VALUE;
goto Exit;
}
@@ -657,6 +658,7 @@
}
if (stream < 0 || uint32_t(stream) >= AUDIO_STREAM_CNT) {
+ LOGE("setStreamVolume() invalid stream %d", stream);
return BAD_VALUE;
}
@@ -691,6 +693,7 @@
if (stream < 0 || uint32_t(stream) >= AUDIO_STREAM_CNT ||
uint32_t(stream) == AUDIO_STREAM_ENFORCED_AUDIBLE) {
+ LOGE("setStreamMute() invalid stream %d", stream);
return BAD_VALUE;
}
@@ -1526,8 +1529,10 @@
for (size_t i = 0; i < mTracks.size(); ++i) {
sp<Track> t = mTracks[i];
if (t != 0) {
- if (sessionId == t->sessionId() &&
- strategy != AudioSystem::getStrategyForStream((audio_stream_type_t)t->type())) {
+ uint32_t actual = AudioSystem::getStrategyForStream((audio_stream_type_t)t->type());
+ if (sessionId == t->sessionId() && strategy != actual) {
+ LOGE("createTrack_l() mismatched strategy; expected %u but found %u",
+ strategy, actual);
lStatus = BAD_VALUE;
goto Exit;
}