summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IAudioPolicyService.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-08-10 10:37:50 -0700
committerEric Laurent <elaurent@google.com>2011-08-11 14:33:45 -0700
commitdb7c079f284f6e91266f6653ae0ec198b1c5006e (patch)
tree08c3569af421bc760cb7b81f611ee0959c4b7b9d /media/libmedia/IAudioPolicyService.cpp
parent8adb83ba4837b3c9de1a4221a5ca4c371a62e38c (diff)
downloadframeworks_av-db7c079f284f6e91266f6653ae0ec198b1c5006e.zip
frameworks_av-db7c079f284f6e91266f6653ae0ec198b1c5006e.tar.gz
frameworks_av-db7c079f284f6e91266f6653ae0ec198b1c5006e.tar.bz2
Audio effects: track CPU and memory use separately
Before this change, CPU and memory usage for an audio effect were registered and checked against the limit by audio policy manager upon effect instantiation. Even if an effect was not enabled it would prevent another effect to be created if the CPU load budget was exceeded, which was too restrictive. This change adds a method to register/unregister CPU load only when an effect is enabled or disabled. It also adds a mechanism to place all effects on the global output mix in suspend state (disabled) when an effect is enabled on a specific session. This will allow applications using session effects to have the priority over others using global effects. Also fixes some issues with suspend/restore mechanism: - avoid taking actions when an effect is disconnected and was not enabled. - do not remove a session from the suspended sessions list when corresponding effect chain is destroyed. Change-Id: I5225278aba1ae13d0d0997bfe26a0c9fb46b17d3
Diffstat (limited to 'media/libmedia/IAudioPolicyService.cpp')
-rw-r--r--media/libmedia/IAudioPolicyService.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index 15f4be0..50b4855 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -53,7 +53,8 @@ enum {
UNREGISTER_EFFECT,
IS_STREAM_ACTIVE,
GET_DEVICES_FOR_STREAM,
- QUERY_DEFAULT_PRE_PROCESSING
+ QUERY_DEFAULT_PRE_PROCESSING,
+ SET_EFFECT_ENABLED
};
class BpAudioPolicyService : public BpInterface<IAudioPolicyService>
@@ -313,6 +314,16 @@ public:
return static_cast <status_t> (reply.readInt32());
}
+ virtual status_t setEffectEnabled(int id, bool enabled)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
+ data.writeInt32(id);
+ data.writeInt32(enabled);
+ remote()->transact(SET_EFFECT_ENABLED, data, &reply);
+ return static_cast <status_t> (reply.readInt32());
+ }
+
virtual bool isStreamActive(int stream, uint32_t inPastMs) const
{
Parcel data, reply;
@@ -577,6 +588,14 @@ status_t BnAudioPolicyService::onTransact(
return NO_ERROR;
} break;
+ case SET_EFFECT_ENABLED: {
+ CHECK_INTERFACE(IAudioPolicyService, data, reply);
+ int id = data.readInt32();
+ bool enabled = static_cast <bool>(data.readInt32());
+ reply->writeInt32(static_cast <int32_t>(setEffectEnabled(id, enabled)));
+ return NO_ERROR;
+ } break;
+
case IS_STREAM_ACTIVE: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
int stream = data.readInt32();