Loading services/audiopolicy/common/managerdefinitions/include/SessionRoute.h +2 −2 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public: void log(const char* prefix); bool isActive() { bool isActiveOrChanged() { return (mDeviceDescriptor != 0) && (mChanged || (mActivityCount > 0)); } Loading Loading @@ -96,7 +96,7 @@ public: int incRouteActivity(audio_session_t session); int decRouteActivity(audio_session_t session); bool hasRouteChanged(audio_session_t session); // also clears the changed flag bool getAndClearRouteChanged(audio_session_t session); // also clears the changed flag void log(const char* caption); // Specify an Output(Sink) route by passing SessionRoute::SOURCE_TYPE_NA in the Loading services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ bool SessionRouteMap::hasRoute(audio_session_t session) return indexOfKey(session) >= 0 && valueFor(session)->mDeviceDescriptor != 0; } bool SessionRouteMap::hasRouteChanged(audio_session_t session) bool SessionRouteMap::getAndClearRouteChanged(audio_session_t session) { if (indexOfKey(session) >= 0) { if (valueFor(session)->mChanged) { Loading Loading @@ -104,9 +104,7 @@ void SessionRouteMap::addRoute(audio_session_t session, sp<SessionRoute> route = indexOfKey(session) >= 0 ? valueFor(session) : 0; if (route != 0) { if (((route->mDeviceDescriptor == 0) && (descriptor != 0)) || ((route->mDeviceDescriptor != 0) && ((descriptor == 0) || (!route->mDeviceDescriptor->equals(descriptor))))) { if (descriptor != 0 || route->mDeviceDescriptor != 0) { route->mChanged = true; } route->mRefCount++; Loading @@ -114,10 +112,10 @@ void SessionRouteMap::addRoute(audio_session_t session, } else { route = new SessionRoute(session, streamType, source, descriptor, uid); route->mRefCount++; add(session, route); if (descriptor != 0) { route->mChanged = true; } add(session, route); } } Loading services/audiopolicy/managerdefault/AudioPolicyManager.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1116,7 +1116,7 @@ status_t AudioPolicyManager::startOutput(audio_io_handle_t output, } else { newDevice = AUDIO_DEVICE_OUT_REMOTE_SUBMIX; } } else if (mOutputRoutes.hasRouteChanged(session)) { } else if (mOutputRoutes.getAndClearRouteChanged(session)) { newDevice = getNewOutputDevice(outputDesc, false /*fromCache*/); checkStrategyRoute(getStrategy(stream), output); } else { Loading Loading @@ -1980,7 +1980,7 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input, // Routing? mInputRoutes.incRouteActivity(session); if (audioSession->activeCount() == 1 || mInputRoutes.hasRouteChanged(session)) { if (audioSession->activeCount() == 1 || mInputRoutes.getAndClearRouteChanged(session)) { // indicate active capture to sound trigger service if starting capture from a mic on // primary HW module audio_devices_t device = getNewInputDevice(inputDesc); Loading Loading @@ -4707,7 +4707,7 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate for (size_t routeIndex = 0; routeIndex < mOutputRoutes.size(); routeIndex++) { sp<SessionRoute> route = mOutputRoutes.valueAt(routeIndex); routing_strategy routeStrategy = getStrategy(route->mStreamType); if ((routeStrategy == strategy) && route->isActive() && if ((routeStrategy == strategy) && route->isActiveOrChanged() && (mAvailableOutputDevices.indexOf(route->mDeviceDescriptor) >= 0)) { return route->mDeviceDescriptor->type(); } Loading Loading @@ -5139,7 +5139,7 @@ audio_devices_t AudioPolicyManager::getDeviceForInputSource(audio_source_t input // then select this device. for (size_t routeIndex = 0; routeIndex < mInputRoutes.size(); routeIndex++) { sp<SessionRoute> route = mInputRoutes.valueAt(routeIndex); if ((inputSource == route->mSource) && route->isActive() && if ((inputSource == route->mSource) && route->isActiveOrChanged() && (mAvailableInputDevices.indexOf(route->mDeviceDescriptor) >= 0)) { return route->mDeviceDescriptor->type(); } Loading Loading
services/audiopolicy/common/managerdefinitions/include/SessionRoute.h +2 −2 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public: void log(const char* prefix); bool isActive() { bool isActiveOrChanged() { return (mDeviceDescriptor != 0) && (mChanged || (mActivityCount > 0)); } Loading Loading @@ -96,7 +96,7 @@ public: int incRouteActivity(audio_session_t session); int decRouteActivity(audio_session_t session); bool hasRouteChanged(audio_session_t session); // also clears the changed flag bool getAndClearRouteChanged(audio_session_t session); // also clears the changed flag void log(const char* caption); // Specify an Output(Sink) route by passing SessionRoute::SOURCE_TYPE_NA in the Loading
services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ bool SessionRouteMap::hasRoute(audio_session_t session) return indexOfKey(session) >= 0 && valueFor(session)->mDeviceDescriptor != 0; } bool SessionRouteMap::hasRouteChanged(audio_session_t session) bool SessionRouteMap::getAndClearRouteChanged(audio_session_t session) { if (indexOfKey(session) >= 0) { if (valueFor(session)->mChanged) { Loading Loading @@ -104,9 +104,7 @@ void SessionRouteMap::addRoute(audio_session_t session, sp<SessionRoute> route = indexOfKey(session) >= 0 ? valueFor(session) : 0; if (route != 0) { if (((route->mDeviceDescriptor == 0) && (descriptor != 0)) || ((route->mDeviceDescriptor != 0) && ((descriptor == 0) || (!route->mDeviceDescriptor->equals(descriptor))))) { if (descriptor != 0 || route->mDeviceDescriptor != 0) { route->mChanged = true; } route->mRefCount++; Loading @@ -114,10 +112,10 @@ void SessionRouteMap::addRoute(audio_session_t session, } else { route = new SessionRoute(session, streamType, source, descriptor, uid); route->mRefCount++; add(session, route); if (descriptor != 0) { route->mChanged = true; } add(session, route); } } Loading
services/audiopolicy/managerdefault/AudioPolicyManager.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -1116,7 +1116,7 @@ status_t AudioPolicyManager::startOutput(audio_io_handle_t output, } else { newDevice = AUDIO_DEVICE_OUT_REMOTE_SUBMIX; } } else if (mOutputRoutes.hasRouteChanged(session)) { } else if (mOutputRoutes.getAndClearRouteChanged(session)) { newDevice = getNewOutputDevice(outputDesc, false /*fromCache*/); checkStrategyRoute(getStrategy(stream), output); } else { Loading Loading @@ -1980,7 +1980,7 @@ status_t AudioPolicyManager::startInput(audio_io_handle_t input, // Routing? mInputRoutes.incRouteActivity(session); if (audioSession->activeCount() == 1 || mInputRoutes.hasRouteChanged(session)) { if (audioSession->activeCount() == 1 || mInputRoutes.getAndClearRouteChanged(session)) { // indicate active capture to sound trigger service if starting capture from a mic on // primary HW module audio_devices_t device = getNewInputDevice(inputDesc); Loading Loading @@ -4707,7 +4707,7 @@ audio_devices_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strate for (size_t routeIndex = 0; routeIndex < mOutputRoutes.size(); routeIndex++) { sp<SessionRoute> route = mOutputRoutes.valueAt(routeIndex); routing_strategy routeStrategy = getStrategy(route->mStreamType); if ((routeStrategy == strategy) && route->isActive() && if ((routeStrategy == strategy) && route->isActiveOrChanged() && (mAvailableOutputDevices.indexOf(route->mDeviceDescriptor) >= 0)) { return route->mDeviceDescriptor->type(); } Loading Loading @@ -5139,7 +5139,7 @@ audio_devices_t AudioPolicyManager::getDeviceForInputSource(audio_source_t input // then select this device. for (size_t routeIndex = 0; routeIndex < mInputRoutes.size(); routeIndex++) { sp<SessionRoute> route = mInputRoutes.valueAt(routeIndex); if ((inputSource == route->mSource) && route->isActive() && if ((inputSource == route->mSource) && route->isActiveOrChanged() && (mAvailableInputDevices.indexOf(route->mDeviceDescriptor) >= 0)) { return route->mDeviceDescriptor->type(); } Loading