summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-06-04 11:51:12 -0700
committerGlenn Kasten <gkasten@google.com>2012-07-16 16:49:01 -0700
commitfd4e20c226eca185fc789de761beae64855bfbbb (patch)
tree7f752ff15fa1f70181281b5dad8c7c987c559b60 /services
parentd96c5724818fb47917bb5e7abe37799735e1ec0e (diff)
downloadframeworks_av-fd4e20c226eca185fc789de761beae64855bfbbb.zip
frameworks_av-fd4e20c226eca185fc789de761beae64855bfbbb.tar.gz
frameworks_av-fd4e20c226eca185fc789de761beae64855bfbbb.tar.bz2
Run audio at priorities 2 and 3 above kernel 1
Also run the watchdog at same priority as the fast mixer. requestPriority() originally used only the caller's pid to decide which cgroup to assign, but in the future it might look at the priority also. So it's safer to use same priority as the fast mixer to be sure we run in the same cgroup. Bug: 6461925 Change-Id: Ia59c93e4b22dacbb6746bfa6ad491be7b72f2b8d
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 0c86e20..e7abc45 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -161,6 +161,10 @@ static const enum {
static uint32_t gScreenState; // incremented by 2 when screen state changes, bit 0 == 1 means "off"
// AudioFlinger::setParameters() updates, other threads read w/o lock
+// Priorities for requestPriority
+static const int kPriorityAudioApp = 2;
+static const int kPriorityFastMixer = 3;
+
// ----------------------------------------------------------------------------
#ifdef ADD_BATTERY_DATA
@@ -1795,10 +1799,10 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac
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,
// so ask activity manager to do this on our behalf
- int err = requestPriority(callingPid, tid, 1);
+ int err = requestPriority(callingPid, tid, kPriorityAudioApp);
if (err != 0) {
ALOGW("Policy SCHED_FIFO priority %d is unavailable for pid %d tid %d; error %d",
- 1, callingPid, tid, err);
+ kPriorityAudioApp, callingPid, tid, err);
}
}
@@ -2281,10 +2285,10 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
// start the fast mixer
mFastMixer->run("FastMixer", PRIORITY_URGENT_AUDIO);
pid_t tid = mFastMixer->getTid();
- int err = requestPriority(getpid_cached, tid, 2);
+ int err = requestPriority(getpid_cached, tid, kPriorityFastMixer);
if (err != 0) {
ALOGW("Policy SCHED_FIFO priority %d is unavailable for pid %d tid %d; error %d",
- 2, getpid_cached, tid, err);
+ kPriorityFastMixer, getpid_cached, tid, err);
}
#ifdef AUDIO_WATCHDOG
@@ -2293,10 +2297,10 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
mAudioWatchdog->setDump(&mAudioWatchdogDump);
mAudioWatchdog->run("AudioWatchdog", PRIORITY_URGENT_AUDIO);
tid = mAudioWatchdog->getTid();
- err = requestPriority(getpid_cached, tid, 1);
+ err = requestPriority(getpid_cached, tid, kPriorityFastMixer);
if (err != 0) {
ALOGW("Policy SCHED_FIFO priority %d is unavailable for pid %d tid %d; error %d",
- 1, getpid_cached, tid, err);
+ kPriorityFastMixer, getpid_cached, tid, err);
}
#endif