summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-02-13 14:46:45 -0800
committerGlenn Kasten <gkasten@google.com>2013-02-15 15:44:50 -0800
commit32584a7d672864b20ab8b83a3cb23c1858e908b7 (patch)
tree87a3d8c3b801d13ceee09abab5048aef46e65332 /services/audioflinger/Threads.cpp
parentab89ac209fd1c3b0a2227168a48d7f3ae9bc43f3 (diff)
downloadframeworks_av-32584a7d672864b20ab8b83a3cb23c1858e908b7.zip
frameworks_av-32584a7d672864b20ab8b83a3cb23c1858e908b7.tar.gz
frameworks_av-32584a7d672864b20ab8b83a3cb23c1858e908b7.tar.bz2
Temporary additional logging to investigate bug
The bug appears related to continuing to use an invalid buffer provider in fast mixer after track destruction, so focus the added logs in that area. Also includes a bug fix: was calling log in an unsafe place near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250. Details: - include caller pid or client pid where appropriate - increase log buffer size - log mFastIndex when AudioMixer sees an invalid bufferProvider. - log both potentially modified and actually modified tracks in FastMixer. - fix benign bug where sq->end() was called more than once. - log StateQueue push() call and return. - increase StateQueue size from 4 to 8 entries - log mixer->enable(), bufferProvider, and currentTrackMask - log buffer provider addresses - increase fast mixer log buffer again - check logf format vs. argument list compatibility - add logging to AudioMixer - add checking of magic field in AudioMixer to detect overwrites - add bool AudioMixer::enabled() - increase log buffer sizes yet again - enable assertion checking without ALOGV - improve a few log messages - check for corruption in more places - log in all the process hooks - add new mixer APIs so we can check for corruption of mixer state - fix a build warning Bug: 6490974 Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r--services/audioflinger/Threads.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index ba848d7..58e3cbe 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1196,6 +1196,8 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac
{ // scope for mLock
Mutex::Autolock _l(mLock);
+ mNBLogWriter->logf("createTrack_l isFast=%d caller=%d",
+ (*flags & IAudioFlinger::TRACK_FAST) != 0, IPCThreadState::self()->getCallingPid());
// all tracks in same audio session must share the same routing strategy otherwise
// conflicts will happen when tracks are moved from one output to another by audio policy
@@ -1249,7 +1251,6 @@ Exit:
if (status) {
*status = lStatus;
}
- mNBLogWriter->logf("createTrack_l");
return track;
}
@@ -1317,7 +1318,8 @@ float AudioFlinger::PlaybackThread::streamVolume(audio_stream_type_t stream) con
// addTrack_l() must be called with ThreadBase::mLock held
status_t AudioFlinger::PlaybackThread::addTrack_l(const sp<Track>& track)
{
- mNBLogWriter->logf("addTrack_l mName=%d", track->mName);
+ mNBLogWriter->logf("addTrack_l mName=%d mFastIndex=%d caller=%d", track->mName,
+ track->mFastIndex, IPCThreadState::self()->getCallingPid());
status_t status = ALREADY_EXISTS;
// set retry count for buffer fill
@@ -1351,7 +1353,9 @@ status_t AudioFlinger::PlaybackThread::addTrack_l(const sp<Track>& track)
// destroyTrack_l() must be called with ThreadBase::mLock held
void AudioFlinger::PlaybackThread::destroyTrack_l(const sp<Track>& track)
{
- mNBLogWriter->logf("destroyTrack_l mName=%d", track->mName);
+ mNBLogWriter->logTimestamp();
+ mNBLogWriter->logf("destroyTrack_l mName=%d mFastIndex=%d mClientPid=%d", track->mName,
+ track->mFastIndex, track->mClient != 0 ? track->mClient->pid() : -1);
track->mState = TrackBase::TERMINATED;
// active tracks are removed by threadLoop()
if (mActiveTracks.indexOf(track) < 0) {
@@ -1361,7 +1365,9 @@ void AudioFlinger::PlaybackThread::destroyTrack_l(const sp<Track>& track)
void AudioFlinger::PlaybackThread::removeTrack_l(const sp<Track>& track)
{
- mNBLogWriter->logf("removeTrack_l mName=%d", track->mName);
+ mNBLogWriter->logTimestamp();
+ mNBLogWriter->logf("removeTrack_l mName=%d mFastIndex=%d clientPid=%d", track->mName,
+ track->mFastIndex, track->mClient != 0 ? track->mClient->pid() : -1);
track->triggerEvents(AudioSystem::SYNC_EVENT_PRESENTATION_COMPLETE);
mTracks.remove(track);
deleteTrackName_l(track->name());
@@ -2149,6 +2155,7 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
FastTrack *fastTrack = &state->mFastTracks[0];
// wrap the source side of the MonoPipe to make it an AudioBufferProvider
fastTrack->mBufferProvider = new SourceAudioBufferProvider(new MonoPipeReader(monoPipe));
+ mNBLogWriter->logf("fastTrack0 bp=%p", fastTrack->mBufferProvider);
fastTrack->mVolumeProvider = NULL;
fastTrack->mGeneration++;
state->mFastTracksGen++;
@@ -2553,6 +2560,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac
// was it previously inactive?
if (!(state->mTrackMask & (1 << j))) {
ExtendedAudioBufferProvider *eabp = track;
+ mNBLogWriter->logf("fastTrack j=%d bp=%p", j, eabp);
VolumeProvider *vp = track;
fastTrack->mBufferProvider = eabp;
fastTrack->mVolumeProvider = vp;
@@ -2839,11 +2847,19 @@ track_is_ready: ;
block = FastMixerStateQueue::BLOCK_UNTIL_ACKED;
pauseAudioWatchdog = true;
}
- sq->end();
}
if (sq != NULL) {
+ unsigned trackMask = state->mTrackMask;
sq->end(didModify);
+ if (didModify) {
+ mNBLogWriter->logTimestamp();
+ mNBLogWriter->logf("push trackMask=%#x block=%d", trackMask, block);
+ }
sq->push(block);
+ if (didModify) {
+ mNBLogWriter->logTimestamp();
+ mNBLogWriter->log("pushed");
+ }
}
#ifdef AUDIO_WATCHDOG
if (pauseAudioWatchdog && mAudioWatchdog != 0) {
@@ -2870,7 +2886,9 @@ track_is_ready: ;
if (CC_UNLIKELY(count)) {
for (size_t i=0 ; i<count ; i++) {
const sp<Track>& track = tracksToRemove->itemAt(i);
- mNBLogWriter->logf("prepareTracks_l remove name=%u", track->name());
+ mNBLogWriter->logTimestamp();
+ mNBLogWriter->logf("prepareTracks_l remove name=%u mFastIndex=%d", track->name(),
+ track->mFastIndex);
mActiveTracks.remove(track);
if (track->mainBuffer() != mMixBuffer) {
chain = getEffectChain_l(track->sessionId());