Loading services/audioflinger/AudioFlinger.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ #define LOG_TAG "AudioFlinger" //#define LOG_NDEBUG 0 //#define ATRACE_TAG ATRACE_TAG_AUDIO #include <math.h> #include <signal.h> #include <sys/time.h> Loading @@ -27,6 +29,7 @@ #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <utils/Log.h> #include <utils/Trace.h> #include <binder/Parcel.h> #include <binder/IPCThreadState.h> #include <utils/String16.h> Loading Loading @@ -2498,6 +2501,7 @@ if (mType == MIXER) { if (!mStandby && delta > maxPeriod) { mNumDelayedWrites++; if ((now - lastWarning) > kWarningThrottleNs) { ScopedTrace st(ATRACE_TAG, "underrun"); ALOGW("write blocked for %llu msecs, %d delayed writes, thread %p", ns2ms(delta), mNumDelayedWrites, this); lastWarning = now; Loading Loading @@ -2593,7 +2597,9 @@ void AudioFlinger::PlaybackThread::threadLoop_write() #define mBitShift 2 // FIXME size_t count = mixBufferSize >> mBitShift; Tracer::traceBegin(ATRACE_TAG, "write"); ssize_t framesWritten = mNormalSink->write(mMixBuffer, count); Tracer::traceEnd(ATRACE_TAG); if (framesWritten > 0) { size_t bytesWritten = framesWritten << mBitShift; mBytesWritten += bytesWritten; Loading services/audioflinger/FastMixer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,12 @@ #define LOG_TAG "FastMixer" //#define LOG_NDEBUG 0 //#define ATRACE_TAG ATRACE_TAG_AUDIO #include <sys/atomics.h> #include <time.h> #include <utils/Log.h> #include <utils/Trace.h> #include <system/audio.h> #ifdef FAST_MIXER_STATISTICS #include <cpustats/CentralTendencyStatistics.h> Loading Loading @@ -359,6 +362,7 @@ bool FastMixer::threadLoop() FastTrackDump *ftDump = &dumpState->mTracks[i]; uint32_t underruns = ftDump->mUnderruns; if (framesReady < frameCount) { ATRACE_INT("underrun", i); ftDump->mUnderruns = (underruns + 2) | 1; if (framesReady == 0) { mixer->disable(name); Loading Loading @@ -387,7 +391,9 @@ bool FastMixer::threadLoop() // FIXME write() is non-blocking and lock-free for a properly implemented NBAIO sink, // but this code should be modified to handle both non-blocking and blocking sinks dumpState->mWriteSequence++; Tracer::traceBegin(ATRACE_TAG, "write"); ssize_t framesWritten = outputSink->write(mixBuffer, frameCount); Tracer::traceEnd(ATRACE_TAG); dumpState->mWriteSequence++; if (framesWritten >= 0) { ALOG_ASSERT(framesWritten <= frameCount); Loading Loading @@ -437,6 +443,7 @@ bool FastMixer::threadLoop() } } if (sec > 0 || nsec > underrunNs) { ScopedTrace st(ATRACE_TAG, "underrun"); // FIXME only log occasionally ALOGV("underrun: time since last cycle %d.%03ld sec", (int) sec, nsec / 1000000L); Loading Loading
services/audioflinger/AudioFlinger.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ #define LOG_TAG "AudioFlinger" //#define LOG_NDEBUG 0 //#define ATRACE_TAG ATRACE_TAG_AUDIO #include <math.h> #include <signal.h> #include <sys/time.h> Loading @@ -27,6 +29,7 @@ #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <utils/Log.h> #include <utils/Trace.h> #include <binder/Parcel.h> #include <binder/IPCThreadState.h> #include <utils/String16.h> Loading Loading @@ -2498,6 +2501,7 @@ if (mType == MIXER) { if (!mStandby && delta > maxPeriod) { mNumDelayedWrites++; if ((now - lastWarning) > kWarningThrottleNs) { ScopedTrace st(ATRACE_TAG, "underrun"); ALOGW("write blocked for %llu msecs, %d delayed writes, thread %p", ns2ms(delta), mNumDelayedWrites, this); lastWarning = now; Loading Loading @@ -2593,7 +2597,9 @@ void AudioFlinger::PlaybackThread::threadLoop_write() #define mBitShift 2 // FIXME size_t count = mixBufferSize >> mBitShift; Tracer::traceBegin(ATRACE_TAG, "write"); ssize_t framesWritten = mNormalSink->write(mMixBuffer, count); Tracer::traceEnd(ATRACE_TAG); if (framesWritten > 0) { size_t bytesWritten = framesWritten << mBitShift; mBytesWritten += bytesWritten; Loading
services/audioflinger/FastMixer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,12 @@ #define LOG_TAG "FastMixer" //#define LOG_NDEBUG 0 //#define ATRACE_TAG ATRACE_TAG_AUDIO #include <sys/atomics.h> #include <time.h> #include <utils/Log.h> #include <utils/Trace.h> #include <system/audio.h> #ifdef FAST_MIXER_STATISTICS #include <cpustats/CentralTendencyStatistics.h> Loading Loading @@ -359,6 +362,7 @@ bool FastMixer::threadLoop() FastTrackDump *ftDump = &dumpState->mTracks[i]; uint32_t underruns = ftDump->mUnderruns; if (framesReady < frameCount) { ATRACE_INT("underrun", i); ftDump->mUnderruns = (underruns + 2) | 1; if (framesReady == 0) { mixer->disable(name); Loading Loading @@ -387,7 +391,9 @@ bool FastMixer::threadLoop() // FIXME write() is non-blocking and lock-free for a properly implemented NBAIO sink, // but this code should be modified to handle both non-blocking and blocking sinks dumpState->mWriteSequence++; Tracer::traceBegin(ATRACE_TAG, "write"); ssize_t framesWritten = outputSink->write(mixBuffer, frameCount); Tracer::traceEnd(ATRACE_TAG); dumpState->mWriteSequence++; if (framesWritten >= 0) { ALOG_ASSERT(framesWritten <= frameCount); Loading Loading @@ -437,6 +443,7 @@ bool FastMixer::threadLoop() } } if (sec > 0 || nsec > underrunNs) { ScopedTrace st(ATRACE_TAG, "underrun"); // FIXME only log occasionally ALOGV("underrun: time since last cycle %d.%03ld sec", (int) sec, nsec / 1000000L); Loading