summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-09-18 18:32:07 -0700
committerEric Laurent <elaurent@google.com>2015-09-22 01:07:14 +0000
commit64265b2fb8f5be63b6c2ad4fcbec9acf74705bc4 (patch)
treea92838f2510034b35b41e78a71bb6385d6f7b557 /services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
parent6fe78a875793188ff80512db247312109038f181 (diff)
downloadframeworks_av-64265b2fb8f5be63b6c2ad4fcbec9acf74705bc4.zip
frameworks_av-64265b2fb8f5be63b6c2ad4fcbec9acf74705bc4.tar.gz
frameworks_av-64265b2fb8f5be63b6c2ad4fcbec9acf74705bc4.tar.bz2
audio policy: fix preemtible capture race
Because a preemtible capture session can preempt another one, we end up in an endless loop situation were each session is allowed to restart after being preempted, thus preempting the other one which restarts and so on. To avoid this situation, we store which audio session was preempted when a particular input started and prevent preemption of this active input by this session. We also inherit sessions from the preempted input to avoid a 3 way preemption loop etc... Bug: 24007220. Change-Id: I0eab5299440ef3ab9e987635dc9a300cf42f2c79
Diffstat (limited to 'services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h')
-rw-r--r--services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
index 18bcfdb..48d09ed 100644
--- a/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
+++ b/services/audiopolicy/common/managerdefinitions/include/AudioInputDescriptor.h
@@ -56,9 +56,21 @@ public:
const struct audio_port_config *srcConfig = NULL) const;
virtual sp<AudioPort> getAudioPort() const { return mProfile; }
void toAudioPort(struct audio_port *port) const;
+ void setPreemptedSessions(const SortedVector<audio_session_t>& sessions);
+ SortedVector<audio_session_t> getPreemptedSessions() const;
+ bool hasPreemptedSession(audio_session_t session) const;
+ void clearPreemptedSessions();
private:
audio_port_handle_t mId;
+ // Because a preemtible capture session can preempt another one, we end up in an endless loop
+ // situation were each session is allowed to restart after being preempted,
+ // thus preempting the other one which restarts and so on.
+ // To avoid this situation, we store which audio session was preempted when
+ // a particular input started and prevent preemption of this active input by this session.
+ // We also inherit sessions from the preempted input to avoid a 3 way preemption loop etc...
+ SortedVector<audio_session_t> mPreemptedSessions;
+
};
class AudioInputCollection :