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

Commit c1dae24a authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Remove debug code HAVE_REQUEST_PRIORITY and SOAKER

Change-Id: I73a2afe72d8acb53e57e6b4e6fb5133e22b7875a
parent 2c75ef40
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ LOCAL_CFLAGS += -DFAST_MIXER_STATISTICS

LOCAL_CFLAGS += -DSTATE_QUEUE_INSTANTIATIONS='"StateQueueInstantiations.cpp"'

LOCAL_CFLAGS += -DHAVE_REQUEST_PRIORITY -UFAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE -USOAKER
LOCAL_CFLAGS += -UFAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE

# uncomment for systrace
# LOCAL_CFLAGS += -DATRACE_TAG=ATRACE_TAG_AUDIO
+0 −26
Original line number Diff line number Diff line
@@ -83,13 +83,7 @@
#include "PipeReader.h"
#include "SourceAudioBufferProvider.h"

#ifdef HAVE_REQUEST_PRIORITY
#include "SchedulingPolicyService.h"
#endif

#ifdef SOAKER
#include "Soaker.h"
#endif

// ----------------------------------------------------------------------------

@@ -1805,7 +1799,6 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac
        }
    }

#ifdef HAVE_REQUEST_PRIORITY
    if ((flags & IAudioFlinger::TRACK_FAST) && (tid != -1)) {
        pid_t callingPid = IPCThreadState::self()->getCallingPid();
        // we don't have CAP_SYS_NICE, nor do we want to have it as it's too powerful,
@@ -1816,7 +1809,6 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac
                    1, callingPid, tid, err);
        }
    }
#endif

    lStatus = NO_ERROR;

@@ -2196,9 +2188,6 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
        audio_io_handle_t id, uint32_t device, type_t type)
    :   PlaybackThread(audioFlinger, output, id, device, type),
        // mAudioMixer below
#ifdef SOAKER
        mSoaker(NULL),
#endif
        // mFastMixer below
        mFastMixerFutex(0)
        // mOutputSink below
@@ -2268,13 +2257,6 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
        mTeeSource = teeSource;
#endif

#ifdef SOAKER
        // create a soaker as workaround for governor issues
        mSoaker = new Soaker();
        // FIXME Soaker should only run when needed, i.e. when FastMixer is not in COLD_IDLE
        mSoaker->run("Soaker", PRIORITY_LOWEST);
#endif

        // create fast mixer and configure it initially with just one fast track for our submix
        mFastMixer = new FastMixer();
        FastMixerStateQueue *sq = mFastMixer->sq();
@@ -2306,14 +2288,12 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud

        // start the fast mixer
        mFastMixer->run("FastMixer", PRIORITY_URGENT_AUDIO);
#ifdef HAVE_REQUEST_PRIORITY
        pid_t tid = mFastMixer->getTid();
        int err = requestPriority(getpid_cached, tid, 2);
        if (err != 0) {
            ALOGW("Policy SCHED_FIFO priority %d is unavailable for pid %d tid %d; error %d",
                    2, getpid_cached, tid, err);
        }
#endif

#ifdef AUDIO_WATCHDOG
        // create and start the watchdog
@@ -2371,12 +2351,6 @@ AudioFlinger::MixerThread::~MixerThread()
        delete fastTrack->mBufferProvider;
        sq->end(false /*didModify*/);
        delete mFastMixer;
#ifdef SOAKER
        if (mSoaker != NULL) {
            mSoaker->requestExitAndWait();
        }
        delete mSoaker;
#endif
        if (mAudioWatchdog != 0) {
            mAudioWatchdog->requestExit();
            mAudioWatchdog->requestExitAndWait();
+0 −3
Original line number Diff line number Diff line
@@ -1168,9 +1168,6 @@ public:

                    AudioMixer* mAudioMixer;    // normal mixer
    private:
#ifdef SOAKER
                    Thread*     mSoaker;
#endif
                    // one-time initialization, no locks required
                    FastMixer*  mFastMixer;         // non-NULL if there is also a fast mixer
                    sp<AudioWatchdog> mAudioWatchdog; // non-0 if there is an audio watchdog thread

services/audioflinger/Soaker.h

deleted100644 → 0
+0 −45
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _ANDROID_AUDIO_SOAKER_H
#define _ANDROID_AUDIO_SOAKER_H

#include <utils/Thread.h>

namespace android {

class Soaker : public Thread {
public:
    Soaker() : Thread() { }
    virtual ~Soaker() { }
protected:
    virtual bool threadLoop() {
        int j = 0;
        for (;;) {
            for (int i = 0; i < 10000; ++i) {
                j += i * i;
            }
            if (exitPending()) {
                return false;
            }
        }
        return j < 555555;
    }
};

}   // namespace android

#endif  // _ANDROID_AUDIO_SOAKER_H