Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dc0a5b7 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Add histograms for FastMixer"

parents 0e335f15 eef598c5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -298,7 +298,8 @@ public:
                            const sp<MmapStreamCallback>& callback,
                            sp<MmapStreamInterface>& interface);
private:
    static const size_t kLogMemorySize = 40 * 1024;
    // FIXME The 400 is temporarily too high until a leak of writers in media.log is fixed.
    static const size_t kLogMemorySize = 400 * 1024;
    sp<MemoryDealer>    mLogMemoryDealer;   // == 0 when NBLog is disabled
    // When a log writer is unregistered, it is done lazily so that media.log can continue to see it
    // for as long as possible.  The memory is only freed when it is needed for another log writer.
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include <audio_utils/format.h>
#include <media/AudioMixer.h>
#include "FastMixer.h"
#include "TypedLogger.h"

namespace android {

@@ -137,6 +138,7 @@ bool FastMixer::isSubClassCommand(FastThreadState::Command command)

void FastMixer::onStateChange()
{
    LOG_HIST_FLUSH();
    const FastMixerState * const current = (const FastMixerState *) mCurrent;
    const FastMixerState * const previous = (const FastMixerState *) mPrevious;
    FastMixerDumpState * const dumpState = (FastMixerDumpState *) mDumpState;
@@ -333,6 +335,7 @@ void FastMixer::onStateChange()

void FastMixer::onWork()
{
    LOG_HIST_TS();
    const FastMixerState * const current = (const FastMixerState *) mCurrent;
    FastMixerDumpState * const dumpState = (FastMixerDumpState *) mDumpState;
    const FastMixerState::Command command = mCommand;
+3 −0
Original line number Diff line number Diff line
@@ -91,6 +91,9 @@ FastThread::~FastThread()

bool FastThread::threadLoop()
{
    // LOGT now works even if logWriterTLS is nullptr, but we're considering changing that,
    // so this initialization permits a future change to remove the check for nullptr.
    logWriterTLS = &mDummyNBLogWriter;
    for (;;) {

        // either nanosleep, sched_yield, or busy wait
+7 −6
Original line number Diff line number Diff line
@@ -2930,7 +2930,6 @@ void AudioFlinger::PlaybackThread::detachAuxEffect_l(int effectId)

bool AudioFlinger::PlaybackThread::threadLoop()
{
    // FIXME Make this an API
    logWriterTLS = mNBLogWriter.get();

    Vector< sp<Track> > tracksToRemove;
@@ -2958,15 +2957,17 @@ bool AudioFlinger::PlaybackThread::threadLoop()

    acquireWakeLock();

    // mNBLogWriter->log can only be called while thread mutex mLock is held.
    // mNBLogWriter logging APIs can only be called by a single thread, typically the
    // thread associated with this PlaybackThread.
    // If you want to share the mNBLogWriter with other threads (for example, binder threads)
    // then all such threads must agree to hold a common mutex before logging.
    // So if you need to log when mutex is unlocked, set logString to a non-NULL string,
    // and then that string will be logged at the next convenient opportunity.
    // See reference to logString below.
    const char *logString = NULL;

    checkSilentMode_l();
#if 0
    int z = 0; // used in logFormat example
#endif

    while (!exitPending())
    {
        // Log merge requests are performed during AudioFlinger binder transactions, but
@@ -2983,8 +2984,8 @@ bool AudioFlinger::PlaybackThread::threadLoop()

            processConfigEvents_l();

            // See comment at declaration of logString for why this is done under mLock
            if (logString != NULL) {
                // FIXME Remove these internal APIs and replace by LOGT
                mNBLogWriter->logTimestamp();
                mNBLogWriter->log(logString);
                logString = NULL;
+1 −1
Original line number Diff line number Diff line
@@ -976,7 +976,7 @@ private:
    sp<NBAIO_Source>        mTeeSource;
#endif
    uint32_t                mScreenState;   // cached copy of gScreenState
    static const size_t     kFastMixerLogSize = 4 * 1024;
    static const size_t     kFastMixerLogSize = 8 * 1024;
    sp<NBLog::Writer>       mFastMixerNBLogWriter;