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

Commit 811cddad authored by Alex Ray's avatar Alex Ray Committed by Android (Google) Code Review
Browse files

Merge "audioflinger: define ANDROID_SMP, remove conditional tracing"

parents a8190fc5 b3a8364e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -78,6 +78,13 @@ LOCAL_CFLAGS += -UFAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE
# LOCAL_SRC_FILES += AudioWatchdog.cpp
# LOCAL_CFLAGS += -DAUDIO_WATCHDOG

# Define ANDROID_SMP appropriately. Used to get inline tracing fast-path.
ifeq ($(TARGET_CPU_SMP),true)
    LOCAL_CFLAGS += -DANDROID_SMP=1
else
    LOCAL_CFLAGS += -DANDROID_SMP=0
endif

include $(BUILD_SHARED_LIBRARY)

#
+10 −21
Original line number Diff line number Diff line
@@ -17,10 +17,7 @@
#define LOG_TAG "FastMixer"
//#define LOG_NDEBUG 0

/** Uncomment for systrace.
 * ATRACE_TAG will default to ATRACE_TAG_NEVER in the header.
 */
//#define ATRACE_TAG ATRACE_TAG_AUDIO
#define ATRACE_TAG ATRACE_TAG_AUDIO

#include <sys/atomics.h>
#include <time.h>
@@ -376,14 +373,14 @@ bool FastMixer::threadLoop()
                // up to 1 ms.  If enough active tracks all blocked in sequence, this would result
                // in the overall fast mix cycle being delayed.  Should use a non-blocking FIFO.
                size_t framesReady = fastTrack->mBufferProvider->framesReady();
#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
                if (ATRACE_ENABLED()) {
                    // I wish we had formatted trace names
                    char traceName[16];
                    strcpy(traceName, "framesReady");
                    traceName[11] = i + (i < 10 ? '0' : 'A' - 10);
                    traceName[12] = '\0';
                    ATRACE_INT(traceName, framesReady);
#endif
                }
                FastTrackDump *ftDump = &dumpState->mTracks[i];
                FastTrackUnderruns underruns = ftDump->mUnderruns;
                if (framesReady < frameCount) {
@@ -429,13 +426,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++;
#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
            ATRACE_BEGIN("write");
#endif
            ssize_t framesWritten = outputSink->write(mixBuffer, frameCount);
#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
            ATRACE_END();
#endif
            dumpState->mWriteSequence++;
            if (framesWritten >= 0) {
                ALOG_ASSERT(framesWritten <= frameCount);
@@ -490,9 +483,7 @@ bool FastMixer::threadLoop()
                sleepNs = -1;
              if (isWarm) {
                if (sec > 0 || nsec > underrunNs) {
#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
                    ScopedTrace st(ATRACE_TAG, "underrun");
#endif
                    ATRACE_NAME("underrun");
                    // FIXME only log occasionally
                    ALOGV("underrun: time since last cycle %d.%03ld sec",
                            (int) sec, nsec / 1000000L);
@@ -572,10 +563,8 @@ bool FastMixer::threadLoop()
                // this store #4 is not atomic with respect to stores #1, #2, #3 above, but
                // the newest open and oldest closed halves are atomic with respect to each other
                dumpState->mBounds = bounds;
#if defined(ATRACE_TAG) && (ATRACE_TAG != ATRACE_TAG_NEVER)
                ATRACE_INT("cycle_ms", monotonicNs / 1000000);
                ATRACE_INT("load_us", loadNs / 1000);
#endif
              }
#endif
            } else {