Loading services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h +1 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ public: * Active ref count of the client will be incremented/decremented through setActive API */ virtual void setClientActive(const sp<TrackClientDescriptor>& client, bool active); bool isClientActive(const sp<TrackClientDescriptor>& client); bool isActive(uint32_t inPastMs) const; bool isActive(VolumeSource volumeSource = VOLUME_SOURCE_NONE, Loading services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,12 @@ void AudioOutputDescriptor::setClientActive(const sp<TrackClientDescriptor>& cli client->setActive(active); } bool AudioOutputDescriptor::isClientActive(const sp<TrackClientDescriptor>& client) { return client != nullptr && std::find(begin(mActiveClients), end(mActiveClients), client) != end(mActiveClients); } bool AudioOutputDescriptor::isActive(VolumeSource vs, uint32_t inPastMs, nsecs_t sysTime) const { return (vs == VOLUME_SOURCE_NONE) ? Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -1954,6 +1954,12 @@ void AudioPolicyManager::releaseOutput(audio_port_handle_t portId) ALOGV("releaseOutput() %d", outputDesc->mIoHandle); sp<TrackClientDescriptor> client = outputDesc->getClient(portId); if (outputDesc->isClientActive(client)) { ALOGW("releaseOutput() inactivates portId %d in good faith", portId); stopOutput(portId); } if (outputDesc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) { if (outputDesc->mDirectOpenCount <= 0) { ALOGW("releaseOutput() invalid open count %d for output %d", Loading @@ -1965,9 +1971,7 @@ void AudioPolicyManager::releaseOutput(audio_port_handle_t portId) mpClientInterface->onAudioPortListUpdate(); } } // stopOutput() needs to be successfully called before releaseOutput() // otherwise there may be inaccurate stream reference counts. // This is checked in outputDesc->removeClient below. outputDesc->removeClient(portId); } Loading Loading
services/audiopolicy/common/managerdefinitions/include/AudioOutputDescriptor.h +1 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ public: * Active ref count of the client will be incremented/decremented through setActive API */ virtual void setClientActive(const sp<TrackClientDescriptor>& client, bool active); bool isClientActive(const sp<TrackClientDescriptor>& client); bool isActive(uint32_t inPastMs) const; bool isActive(VolumeSource volumeSource = VOLUME_SOURCE_NONE, Loading
services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,12 @@ void AudioOutputDescriptor::setClientActive(const sp<TrackClientDescriptor>& cli client->setActive(active); } bool AudioOutputDescriptor::isClientActive(const sp<TrackClientDescriptor>& client) { return client != nullptr && std::find(begin(mActiveClients), end(mActiveClients), client) != end(mActiveClients); } bool AudioOutputDescriptor::isActive(VolumeSource vs, uint32_t inPastMs, nsecs_t sysTime) const { return (vs == VOLUME_SOURCE_NONE) ? Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -1954,6 +1954,12 @@ void AudioPolicyManager::releaseOutput(audio_port_handle_t portId) ALOGV("releaseOutput() %d", outputDesc->mIoHandle); sp<TrackClientDescriptor> client = outputDesc->getClient(portId); if (outputDesc->isClientActive(client)) { ALOGW("releaseOutput() inactivates portId %d in good faith", portId); stopOutput(portId); } if (outputDesc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) { if (outputDesc->mDirectOpenCount <= 0) { ALOGW("releaseOutput() invalid open count %d for output %d", Loading @@ -1965,9 +1971,7 @@ void AudioPolicyManager::releaseOutput(audio_port_handle_t portId) mpClientInterface->onAudioPortListUpdate(); } } // stopOutput() needs to be successfully called before releaseOutput() // otherwise there may be inaccurate stream reference counts. // This is checked in outputDesc->removeClient below. outputDesc->removeClient(portId); } Loading