Loading services/audioflinger/Threads.cpp +22 −7 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ static const uint32_t kMinNormalMixBufferSizeMs = 20; // maximum normal mix buffer size static const uint32_t kMaxNormalMixBufferSizeMs = 24; // Offloaded output thread standby delay: allows track transition without going to standby static const nsecs_t kOffloadStandbyDelayNs = seconds(1); // Whether to use fast mixer static const enum { FastMixer_Never, // never initialize or use: for debugging only Loading Loading @@ -2137,13 +2140,11 @@ bool AudioFlinger::PlaybackThread::threadLoop() mWaitWorkCV.wait(mLock); ALOGV("async completion/wake"); acquireWakeLock_l(); standbyTime = systemTime() + standbyDelay; sleepTime = 0; if (exitPending()) { break; } if (!mActiveTracks.size() && (systemTime() > standbyTime)) { continue; } sleepTime = 0; } else if ((!mActiveTracks.size() && systemTime() > standbyTime) || isSuspended()) { // put audio hardware into standby after short delay Loading Loading @@ -3701,7 +3702,11 @@ void AudioFlinger::DirectOutputThread::cacheParameters_l() // use shorter standby delay as on normal output to release // hardware resources as soon as possible if (audio_is_linear_pcm(mFormat)) { standbyDelay = microseconds(activeSleepTime*2); } else { standbyDelay = kOffloadStandbyDelayNs; } } // ---------------------------------------------------------------------------- Loading Loading @@ -3837,6 +3842,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr size_t count = mActiveTracks.size(); mixer_state mixerStatus = MIXER_IDLE; bool doHwPause = false; bool doHwResume = false; // find out which tracks need to be processed for (size_t i = 0; i < count; i++) { sp<Track> t = mActiveTracks[i].promote(); Loading Loading @@ -3868,7 +3876,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr track->setPaused(); if (last) { if (!mHwPaused) { mOutput->stream->pause(mOutput->stream); doHwPause = true; mHwPaused = true; } // If we were part way through writing the mixbuffer to Loading Loading @@ -3901,7 +3909,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr if (last) { if (mHwPaused) { mOutput->stream->resume(mOutput->stream); doHwResume = true; mHwPaused = false; // threadLoop_mix() will handle the case that we need to // resume an interrupted write Loading Loading @@ -3963,10 +3971,17 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr processVolume_l(track, last); } // make sure the pause/flush/resume sequence is executed in the right order if (doHwPause) { mOutput->stream->pause(mOutput->stream); } if (mFlushPending) { flushHw_l(); mFlushPending = false; } if (doHwResume) { mOutput->stream->resume(mOutput->stream); } // remove all the tracks that need to be... removeTracks_l(*tracksToRemove); Loading services/audioflinger/Tracks.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) nowInUnderrun = '?'; break; } snprintf(&buffer[7], size-7, " %6u %4u %3u %08X %7u %6u %1c %1d %5u %5.2g %5.2g " snprintf(&buffer[7], size-7, " %6u %4u %08X %08X %7u %6u %1c %1d %5u %5.2g %5.2g " "%08X %08X %08X 0x%03X %9u%c\n", (mClient == 0) ? getpid_cached : mClient->pid(), mStreamType, Loading Loading
services/audioflinger/Threads.cpp +22 −7 Original line number Diff line number Diff line Loading @@ -109,6 +109,9 @@ static const uint32_t kMinNormalMixBufferSizeMs = 20; // maximum normal mix buffer size static const uint32_t kMaxNormalMixBufferSizeMs = 24; // Offloaded output thread standby delay: allows track transition without going to standby static const nsecs_t kOffloadStandbyDelayNs = seconds(1); // Whether to use fast mixer static const enum { FastMixer_Never, // never initialize or use: for debugging only Loading Loading @@ -2137,13 +2140,11 @@ bool AudioFlinger::PlaybackThread::threadLoop() mWaitWorkCV.wait(mLock); ALOGV("async completion/wake"); acquireWakeLock_l(); standbyTime = systemTime() + standbyDelay; sleepTime = 0; if (exitPending()) { break; } if (!mActiveTracks.size() && (systemTime() > standbyTime)) { continue; } sleepTime = 0; } else if ((!mActiveTracks.size() && systemTime() > standbyTime) || isSuspended()) { // put audio hardware into standby after short delay Loading Loading @@ -3701,7 +3702,11 @@ void AudioFlinger::DirectOutputThread::cacheParameters_l() // use shorter standby delay as on normal output to release // hardware resources as soon as possible if (audio_is_linear_pcm(mFormat)) { standbyDelay = microseconds(activeSleepTime*2); } else { standbyDelay = kOffloadStandbyDelayNs; } } // ---------------------------------------------------------------------------- Loading Loading @@ -3837,6 +3842,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr size_t count = mActiveTracks.size(); mixer_state mixerStatus = MIXER_IDLE; bool doHwPause = false; bool doHwResume = false; // find out which tracks need to be processed for (size_t i = 0; i < count; i++) { sp<Track> t = mActiveTracks[i].promote(); Loading Loading @@ -3868,7 +3876,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr track->setPaused(); if (last) { if (!mHwPaused) { mOutput->stream->pause(mOutput->stream); doHwPause = true; mHwPaused = true; } // If we were part way through writing the mixbuffer to Loading Loading @@ -3901,7 +3909,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr if (last) { if (mHwPaused) { mOutput->stream->resume(mOutput->stream); doHwResume = true; mHwPaused = false; // threadLoop_mix() will handle the case that we need to // resume an interrupted write Loading Loading @@ -3963,10 +3971,17 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr processVolume_l(track, last); } // make sure the pause/flush/resume sequence is executed in the right order if (doHwPause) { mOutput->stream->pause(mOutput->stream); } if (mFlushPending) { flushHw_l(); mFlushPending = false; } if (doHwResume) { mOutput->stream->resume(mOutput->stream); } // remove all the tracks that need to be... removeTracks_l(*tracksToRemove); Loading
services/audioflinger/Tracks.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size) nowInUnderrun = '?'; break; } snprintf(&buffer[7], size-7, " %6u %4u %3u %08X %7u %6u %1c %1d %5u %5.2g %5.2g " snprintf(&buffer[7], size-7, " %6u %4u %08X %08X %7u %6u %1c %1d %5u %5.2g %5.2g " "%08X %08X %08X 0x%03X %9u%c\n", (mClient == 0) ? getpid_cached : mClient->pid(), mStreamType, Loading