From efe087370361f5600e82243edfe4dcc64e0144b6 Mon Sep 17 00:00:00 2001 From: Martin Koch Date: Wed, 1 Jul 2020 14:46:52 +0200 Subject: AMCore: correct behavior regarding registration of early connections - modify enterConnectionDB() and enterMainConnectionDB() to accept also connections using reserved (peeked-only) sources and/or sinks Signed-off-by: Martin Koch --- AudioManagerCore/src/CAmDatabaseHandlerMap.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'AudioManagerCore/src/CAmDatabaseHandlerMap.cpp') diff --git a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp index 95d7b1a..fc539bb 100644 --- a/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp +++ b/AudioManagerCore/src/CAmDatabaseHandlerMap.cpp @@ -585,7 +585,7 @@ int16_t CAmDatabaseHandlerMap::calculateDelayForRoute(const std::vectorsecond.reserved && !allowReserved)) { logError(__METHOD_NAME__, "sinkID must be valid!"); return (E_NOT_POSSIBLE); } - if (!existSource(mainConnectionData.sourceID)) + auto itMappedSource = mMappedData.mSourceMap.find(mainConnectionData.sourceID); + if ((itMappedSource == mMappedData.mSourceMap.end()) || (itMappedSource->second.reserved && !allowReserved)) { logError(__METHOD_NAME__, "sourceID must be valid!"); return (E_NOT_POSSIBLE); @@ -1163,7 +1165,7 @@ am_Error_e CAmDatabaseHandlerMap::enterSourceDB(const am_Source_s &sourceData, a return (E_OK); } -am_Error_e CAmDatabaseHandlerMap::enterConnectionDB(const am_Connection_s &connection, am_connectionID_t &connectionID) +am_Error_e CAmDatabaseHandlerMap::enterConnectionDB(const am_Connection_s &connection, am_connectionID_t &connectionID, bool allowReserved) { if (connection.connectionID != 0) { @@ -1171,13 +1173,15 @@ am_Error_e CAmDatabaseHandlerMap::enterConnectionDB(const am_Connection_s &conne return (E_NOT_POSSIBLE); } - if (!existSink(connection.sinkID)) + const AmMapSink::const_iterator &itMappedSink = mMappedData.mSinkMap.find(connection.sinkID); + if ((itMappedSink == mMappedData.mSinkMap.end()) || (itMappedSink->second.reserved && !allowReserved)) { logError(__METHOD_NAME__, "sinkID must exist!"); return (E_NOT_POSSIBLE); } - if (!existSource(connection.sourceID)) + const AmMapSource::const_iterator &itMappedSource = mMappedData.mSourceMap.find(connection.sourceID); + if ((itMappedSource == mMappedData.mSourceMap.end()) || (itMappedSource->second.reserved && !allowReserved)) { logError(__METHOD_NAME__, "sourceID must exist!"); return (E_NOT_POSSIBLE); -- cgit v1.2.1