summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/ISchedulingPolicyService.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-04-23 12:39:37 -0700
committerGlenn Kasten <gkasten@google.com>2013-04-23 14:18:18 -0700
commitf8197a6a9d9363cb52bb8a2c15c0e5a52064355e (patch)
treeefad34614c9d7e77ed830768279005004376bbb2 /services/audioflinger/ISchedulingPolicyService.cpp
parent1e25b79b28e578c43607faf100dcaf4cf068f05a (diff)
downloadframeworks_av-f8197a6a9d9363cb52bb8a2c15c0e5a52064355e.zip
frameworks_av-f8197a6a9d9363cb52bb8a2c15c0e5a52064355e.tar.gz
frameworks_av-f8197a6a9d9363cb52bb8a2c15c0e5a52064355e.tar.bz2
Remove timing jitter during startup of audio
This fixes a regression introduced recently, that increased timing jitter during the startup of the FastMixer and AudioTrack callback threads. The regression was to make requestPriority() asynchronous as a way to avoid an apparent priority inversion in system_server. This means that the target thread could run briefly with the initial priority, before the new priority takes effect. This change removes the startup jitter for FastMixer, by making the requestPriority() synchronous again for that case. It doesn't matter that this restores the priority inversion involving normal mixer thread, because it happens during startup of both threads. The change also removes the startup jitter for the AudioTrack callback thread, by having the target thread check whether the requestPriority() has completed yet. If not, the target thread blocks with a timeout until the priority boost finishes. Finally, we now log an error message if the expected priority boost doesn't happen. Bug: 8698989 Change-Id: Id590e9a274b70ec1ba85b44a585ee37a22e41cbc
Diffstat (limited to 'services/audioflinger/ISchedulingPolicyService.cpp')
-rw-r--r--services/audioflinger/ISchedulingPolicyService.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/audioflinger/ISchedulingPolicyService.cpp b/services/audioflinger/ISchedulingPolicyService.cpp
index 218aa6b..0079968 100644
--- a/services/audioflinger/ISchedulingPolicyService.cpp
+++ b/services/audioflinger/ISchedulingPolicyService.cpp
@@ -37,14 +37,15 @@ public:
{
}
- virtual int requestPriority(int32_t pid, int32_t tid, int32_t prio)
+ virtual int requestPriority(int32_t pid, int32_t tid, int32_t prio, bool asynchronous)
{
Parcel data, reply;
data.writeInterfaceToken(ISchedulingPolicyService::getInterfaceDescriptor());
data.writeInt32(pid);
data.writeInt32(tid);
data.writeInt32(prio);
- remote()->transact(REQUEST_PRIORITY_TRANSACTION, data, &reply, IBinder::FLAG_ONEWAY);
+ uint32_t flags = asynchronous ? IBinder::FLAG_ONEWAY : 0;
+ remote()->transact(REQUEST_PRIORITY_TRANSACTION, data, &reply, flags);
// fail on exception
if (reply.readExceptionCode() != 0) return -1;
return reply.readInt32();