am abc55c69
: AudioPolicyManager supports querying active record sources
* commit 'abc55c698301e05a80d7f9394c75abca0b307602': AudioPolicyManager supports querying active record sources
This commit is contained in:
commit
f176125414
4 changed files with 22 additions and 0 deletions
|
@ -1159,6 +1159,19 @@ bool AudioPolicyManagerBase::isStreamActive(int stream, uint32_t inPastMs) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool AudioPolicyManagerBase::isSourceActive(audio_source_t source) const
|
||||
{
|
||||
for (size_t i = 0; i < mInputs.size(); i++) {
|
||||
const AudioInputDescriptor * inputDescriptor = mInputs.valueAt(i);
|
||||
if ((inputDescriptor->mInputSource == (int) source)
|
||||
&& (inputDescriptor->mRefCount > 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
status_t AudioPolicyManagerBase::dump(int fd)
|
||||
{
|
||||
|
|
|
@ -302,6 +302,12 @@ static bool ap_is_stream_active(const struct audio_policy *pol, audio_stream_typ
|
|||
return lap->apm->isStreamActive((int) stream, in_past_ms);
|
||||
}
|
||||
|
||||
static bool ap_is_source_active(const struct audio_policy *pol, audio_source_t source)
|
||||
{
|
||||
const struct legacy_audio_policy *lap = to_clap(pol);
|
||||
return lap->apm->isSourceActive(source);
|
||||
}
|
||||
|
||||
static int ap_dump(const struct audio_policy *pol, int fd)
|
||||
{
|
||||
const struct legacy_audio_policy *lap = to_clap(pol);
|
||||
|
@ -352,6 +358,7 @@ static int create_legacy_ap(const struct audio_policy_device *device,
|
|||
lap->policy.unregister_effect = ap_unregister_effect;
|
||||
lap->policy.set_effect_enabled = ap_set_effect_enabled;
|
||||
lap->policy.is_stream_active = ap_is_stream_active;
|
||||
lap->policy.is_source_active = ap_is_source_active;
|
||||
lap->policy.dump = ap_dump;
|
||||
|
||||
lap->service = service;
|
||||
|
|
|
@ -157,6 +157,7 @@ public:
|
|||
virtual status_t setEffectEnabled(int id, bool enabled) = 0;
|
||||
|
||||
virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const = 0;
|
||||
virtual bool isSourceActive(audio_source_t source) const = 0;
|
||||
|
||||
//dump state
|
||||
virtual status_t dump(int fd) = 0;
|
||||
|
|
|
@ -133,6 +133,7 @@ public:
|
|||
virtual status_t setEffectEnabled(int id, bool enabled);
|
||||
|
||||
virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const;
|
||||
virtual bool isSourceActive(audio_source_t source) const;
|
||||
|
||||
virtual status_t dump(int fd);
|
||||
|
||||
|
|
Loading…
Reference in a new issue