Loading media/libnbaio/include/media/nbaio/AudioStreamOutSink.h +0 −4 Original line number Original line Diff line number Diff line Loading @@ -42,10 +42,6 @@ public: //virtual size_t framesUnderrun() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; //virtual size_t underruns() const; // This is an over-estimate, and could dupe the caller into making a blocking write() // FIXME Use an audio HAL API to query the buffer emptying status when it's available. virtual ssize_t availableToWrite() { return mStreamBufferSizeBytes / mFrameSize; } virtual ssize_t write(const void *buffer, size_t count); virtual ssize_t write(const void *buffer, size_t count); virtual status_t getTimestamp(ExtendedTimestamp ×tamp); virtual status_t getTimestamp(ExtendedTimestamp ×tamp); Loading services/audioflinger/Threads.cpp +26 −0 Original line number Original line Diff line number Diff line Loading @@ -644,6 +644,7 @@ void AudioFlinger::ThreadBase::sendIoConfigEvent_l(audio_io_config_event_t event mIoJitterMs.reset(); mIoJitterMs.reset(); mLatencyMs.reset(); mLatencyMs.reset(); mProcessTimeMs.reset(); mProcessTimeMs.reset(); mMonopipePipeDepthStats.reset(); mTimestampVerifier.discontinuity(mTimestampVerifier.DISCONTINUITY_MODE_CONTINUOUS); mTimestampVerifier.discontinuity(mTimestampVerifier.DISCONTINUITY_MODE_CONTINUOUS); sp<ConfigEvent> configEvent = (ConfigEvent *)new IoConfigEvent(event, pid, portId); sp<ConfigEvent> configEvent = (ConfigEvent *)new IoConfigEvent(event, pid, portId); Loading Loading @@ -988,6 +989,12 @@ void AudioFlinger::ThreadBase::dumpBase_l(int fd, const Vector<String16>& args _ isOutput() ? "write" : "read", isOutput() ? "write" : "read", mLatencyMs.toString().c_str()); mLatencyMs.toString().c_str()); } } if (mMonopipePipeDepthStats.getN() > 0) { dprintf(fd, " Monopipe %s pipe depth stats: %s\n", isOutput() ? "write" : "read", mMonopipePipeDepthStats.toString().c_str()); } } } void AudioFlinger::ThreadBase::dumpEffectChains_l(int fd, const Vector<String16>& args) void AudioFlinger::ThreadBase::dumpEffectChains_l(int fd, const Vector<String16>& args) Loading Loading @@ -1917,6 +1924,12 @@ void AudioFlinger::ThreadBase::sendStatistics(bool force) item->setDouble(MM_PREFIX "latencyMs.mean", mLatencyMs.getMean()); item->setDouble(MM_PREFIX "latencyMs.mean", mLatencyMs.getMean()); item->setDouble(MM_PREFIX "latencyMs.std", mLatencyMs.getStdDev()); item->setDouble(MM_PREFIX "latencyMs.std", mLatencyMs.getStdDev()); } } if (mMonopipePipeDepthStats.getN() > 0) { item->setDouble(MM_PREFIX "monopipePipeDepthStats.mean", mMonopipePipeDepthStats.getMean()); item->setDouble(MM_PREFIX "monopipePipeDepthStats.std", mMonopipePipeDepthStats.getStdDev()); } item->selfrecord(); item->selfrecord(); } } Loading Loading @@ -3972,6 +3985,18 @@ bool AudioFlinger::PlaybackThread::threadLoop() Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); mIoJitterMs.add(jitterMs); mIoJitterMs.add(jitterMs); mProcessTimeMs.add(processMs); mProcessTimeMs.add(processMs); if (mPipeSink.get() != nullptr) { // Using the Monopipe availableToWrite, we estimate the current // buffer size. MonoPipe* monoPipe = static_cast<MonoPipe*>(mPipeSink.get()); const ssize_t availableToWrite = mPipeSink->availableToWrite(); const size_t pipeFrames = monoPipe->maxFrames(); const size_t remainingFrames = pipeFrames - max(availableToWrite, 0); mMonopipePipeDepthStats.add(remainingFrames); } } } // write blocked detection // write blocked detection Loading Loading @@ -7583,6 +7608,7 @@ reacquire_wakelock: const ssize_t availableToRead = mPipeSource->availableToRead(); const ssize_t availableToRead = mPipeSource->availableToRead(); if (availableToRead >= 0) { if (availableToRead >= 0) { mMonopipePipeDepthStats.add(availableToRead); // PipeSource is the primary clock. It is up to the AudioRecord client to keep up. // PipeSource is the primary clock. It is up to the AudioRecord client to keep up. LOG_ALWAYS_FATAL_IF((size_t)availableToRead > mPipeFramesP2, LOG_ALWAYS_FATAL_IF((size_t)availableToRead > mPipeFramesP2, "more frames to read than fifo size, %zd > %zu", "more frames to read than fifo size, %zd > %zu", Loading services/audioflinger/Threads.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -684,6 +684,7 @@ protected: audio_utils::Statistics<double> mIoJitterMs{0.995 /* alpha */}; audio_utils::Statistics<double> mIoJitterMs{0.995 /* alpha */}; audio_utils::Statistics<double> mProcessTimeMs{0.995 /* alpha */}; audio_utils::Statistics<double> mProcessTimeMs{0.995 /* alpha */}; audio_utils::Statistics<double> mLatencyMs{0.995 /* alpha */}; audio_utils::Statistics<double> mLatencyMs{0.995 /* alpha */}; audio_utils::Statistics<double> mMonopipePipeDepthStats{0.999 /* alpha */}; // Save the last count when we delivered statistics to mediametrics. // Save the last count when we delivered statistics to mediametrics. int64_t mLastRecordedTimestampVerifierN = 0; int64_t mLastRecordedTimestampVerifierN = 0; Loading Loading
media/libnbaio/include/media/nbaio/AudioStreamOutSink.h +0 −4 Original line number Original line Diff line number Diff line Loading @@ -42,10 +42,6 @@ public: //virtual size_t framesUnderrun() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; //virtual size_t underruns() const; // This is an over-estimate, and could dupe the caller into making a blocking write() // FIXME Use an audio HAL API to query the buffer emptying status when it's available. virtual ssize_t availableToWrite() { return mStreamBufferSizeBytes / mFrameSize; } virtual ssize_t write(const void *buffer, size_t count); virtual ssize_t write(const void *buffer, size_t count); virtual status_t getTimestamp(ExtendedTimestamp ×tamp); virtual status_t getTimestamp(ExtendedTimestamp ×tamp); Loading
services/audioflinger/Threads.cpp +26 −0 Original line number Original line Diff line number Diff line Loading @@ -644,6 +644,7 @@ void AudioFlinger::ThreadBase::sendIoConfigEvent_l(audio_io_config_event_t event mIoJitterMs.reset(); mIoJitterMs.reset(); mLatencyMs.reset(); mLatencyMs.reset(); mProcessTimeMs.reset(); mProcessTimeMs.reset(); mMonopipePipeDepthStats.reset(); mTimestampVerifier.discontinuity(mTimestampVerifier.DISCONTINUITY_MODE_CONTINUOUS); mTimestampVerifier.discontinuity(mTimestampVerifier.DISCONTINUITY_MODE_CONTINUOUS); sp<ConfigEvent> configEvent = (ConfigEvent *)new IoConfigEvent(event, pid, portId); sp<ConfigEvent> configEvent = (ConfigEvent *)new IoConfigEvent(event, pid, portId); Loading Loading @@ -988,6 +989,12 @@ void AudioFlinger::ThreadBase::dumpBase_l(int fd, const Vector<String16>& args _ isOutput() ? "write" : "read", isOutput() ? "write" : "read", mLatencyMs.toString().c_str()); mLatencyMs.toString().c_str()); } } if (mMonopipePipeDepthStats.getN() > 0) { dprintf(fd, " Monopipe %s pipe depth stats: %s\n", isOutput() ? "write" : "read", mMonopipePipeDepthStats.toString().c_str()); } } } void AudioFlinger::ThreadBase::dumpEffectChains_l(int fd, const Vector<String16>& args) void AudioFlinger::ThreadBase::dumpEffectChains_l(int fd, const Vector<String16>& args) Loading Loading @@ -1917,6 +1924,12 @@ void AudioFlinger::ThreadBase::sendStatistics(bool force) item->setDouble(MM_PREFIX "latencyMs.mean", mLatencyMs.getMean()); item->setDouble(MM_PREFIX "latencyMs.mean", mLatencyMs.getMean()); item->setDouble(MM_PREFIX "latencyMs.std", mLatencyMs.getStdDev()); item->setDouble(MM_PREFIX "latencyMs.std", mLatencyMs.getStdDev()); } } if (mMonopipePipeDepthStats.getN() > 0) { item->setDouble(MM_PREFIX "monopipePipeDepthStats.mean", mMonopipePipeDepthStats.getMean()); item->setDouble(MM_PREFIX "monopipePipeDepthStats.std", mMonopipePipeDepthStats.getStdDev()); } item->selfrecord(); item->selfrecord(); } } Loading Loading @@ -3972,6 +3985,18 @@ bool AudioFlinger::PlaybackThread::threadLoop() Mutex::Autolock _l(mLock); Mutex::Autolock _l(mLock); mIoJitterMs.add(jitterMs); mIoJitterMs.add(jitterMs); mProcessTimeMs.add(processMs); mProcessTimeMs.add(processMs); if (mPipeSink.get() != nullptr) { // Using the Monopipe availableToWrite, we estimate the current // buffer size. MonoPipe* monoPipe = static_cast<MonoPipe*>(mPipeSink.get()); const ssize_t availableToWrite = mPipeSink->availableToWrite(); const size_t pipeFrames = monoPipe->maxFrames(); const size_t remainingFrames = pipeFrames - max(availableToWrite, 0); mMonopipePipeDepthStats.add(remainingFrames); } } } // write blocked detection // write blocked detection Loading Loading @@ -7583,6 +7608,7 @@ reacquire_wakelock: const ssize_t availableToRead = mPipeSource->availableToRead(); const ssize_t availableToRead = mPipeSource->availableToRead(); if (availableToRead >= 0) { if (availableToRead >= 0) { mMonopipePipeDepthStats.add(availableToRead); // PipeSource is the primary clock. It is up to the AudioRecord client to keep up. // PipeSource is the primary clock. It is up to the AudioRecord client to keep up. LOG_ALWAYS_FATAL_IF((size_t)availableToRead > mPipeFramesP2, LOG_ALWAYS_FATAL_IF((size_t)availableToRead > mPipeFramesP2, "more frames to read than fifo size, %zd > %zu", "more frames to read than fifo size, %zd > %zu", Loading
services/audioflinger/Threads.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -684,6 +684,7 @@ protected: audio_utils::Statistics<double> mIoJitterMs{0.995 /* alpha */}; audio_utils::Statistics<double> mIoJitterMs{0.995 /* alpha */}; audio_utils::Statistics<double> mProcessTimeMs{0.995 /* alpha */}; audio_utils::Statistics<double> mProcessTimeMs{0.995 /* alpha */}; audio_utils::Statistics<double> mLatencyMs{0.995 /* alpha */}; audio_utils::Statistics<double> mLatencyMs{0.995 /* alpha */}; audio_utils::Statistics<double> mMonopipePipeDepthStats{0.999 /* alpha */}; // Save the last count when we delivered statistics to mediametrics. // Save the last count when we delivered statistics to mediametrics. int64_t mLastRecordedTimestampVerifierN = 0; int64_t mLastRecordedTimestampVerifierN = 0; Loading