@@ -125,29 +125,30 @@ std::string StreamManager::getRTSPDescribeString() const {
125125 return StringConverter::stringFormat (" @#1,@#2,@#3" , dvb_s2, dvb_t + dvb_t2, dvb_c + dvb_c2);
126126}
127127
128- FeID StreamManager::findFrontendIDWithStreamID (const StreamID id) const {
128+ std::tuple<FeIndex, FeID> StreamManager::findFrontendIDWithStreamID (const StreamID id) const {
129129 for (SpStream stream : _streamVector) {
130130 if (stream->getStreamID () == id) {
131- return stream->getFeID ();
131+ return { stream->getFeIndex (), stream-> getFeID () } ;
132132 }
133133 }
134- return FeID ();
134+ return { FeIndex (), FeID () } ;
135135}
136136
137- std::pair< FeID, StreamID> StreamManager::findFrontendID (const TransportParamVector& params) const {
137+ std::tuple<FeIndex, FeID, StreamID> StreamManager::findFrontendID (const TransportParamVector& params) const {
138138 const StreamID streamID = params.getIntParameter (" stream" );
139- const FeID feID = params.getIntParameter (" fe" );
139+ FeID feID = params.getIntParameter (" fe" );
140140 // Did we find StreamID an NO FrondendID
141141 if (streamID != -1 && feID == -1 ) {
142- return { findFrontendIDWithStreamID (streamID), streamID };
142+ const auto [index, feID] = findFrontendIDWithStreamID (streamID);
143+ return { index, feID, streamID };
143144 }
144145 // Is the requested FrondendID in range, then return this
145146 if (feID >= 1 && feID <= static_cast <int >(_streamVector.size ())) {
146- // We start with FeID = 0, therefore we subtract 1 from transport parameter 'fe='
147- return { feID - 1 , streamID};
147+ // The vector starts at 0, therefore we subtract 1 from transport parameter 'fe='/'FeID '
148+ return { feID - 1 , feID, streamID };
148149 }
149- // Out of range, return -1, -1
150- return { FeID (), StreamID () };
150+ // Out of range, return -1, -1, -1
151+ return { FeIndex (), FeID (), StreamID () };
151152}
152153
153154SpStream StreamManager::findStreamAndClientIDFor (SocketClient &socketClient, int &clientID) {
@@ -156,8 +157,8 @@ SpStream StreamManager::findStreamAndClientIDFor(SocketClient &socketClient, int
156157 HeaderVector headers = socketClient.getHeaders ();
157158 TransportParamVector params = socketClient.getTransportParameters ();
158159
159- // Now find FrontendID and/or StreamID of this message
160- const auto [feID, streamID] = findFrontendID (params);
160+ // Now find index for FrontendID and/or StreamID of this message
161+ const auto [feIndex, feID, streamID] = findFrontendID (params);
161162
162163 std::string sessionID = headers.getFieldParameter (" Session" );
163164 bool newSession = false ;
@@ -179,8 +180,8 @@ SpStream StreamManager::findStreamAndClientIDFor(SocketClient &socketClient, int
179180 }
180181 }
181182
182- // if no FeID , then we have to find a suitable one
183- if (feID == -1 ) {
183+ // if no index , then we have to find a suitable one
184+ if (feIndex == -1 ) {
184185 SI_LOG_INFO (" Found FrondtendID: x (fe=x) StreamID: x SessionID: @#1" , sessionID);
185186 for (SpStream stream : _streamVector) {
186187 if (stream->findClientIDFor (socketClient, newSession, sessionID, clientID)) {
@@ -189,11 +190,11 @@ SpStream StreamManager::findStreamAndClientIDFor(SocketClient &socketClient, int
189190 }
190191 }
191192 } else {
192- SI_LOG_INFO (" Found FrondtendID: @#1 (fe=@#2) StreamID: @#3 SessionID: @#4" , feID, feID + 1 , streamID, sessionID);
193+ SI_LOG_INFO (" Found FrondtendID: @#1 (fe=@#2) StreamID: @#3 SessionID: @#4" , feID, feID, streamID, sessionID);
193194 // Did we find the StreamClient?
194- if (_streamVector[feID. getID () ]->findClientIDFor (socketClient, newSession, sessionID, clientID)) {
195- _streamVector[feID. getID () ]->getStreamClient (clientID).setSessionID (sessionID);
196- return _streamVector[feID. getID () ];
195+ if (_streamVector[feIndex ]->findClientIDFor (socketClient, newSession, sessionID, clientID)) {
196+ _streamVector[feIndex ]->getStreamClient (clientID).setSessionID (sessionID);
197+ return _streamVector[feIndex ];
197198 }
198199 // No, Then try to search in other Streams
199200 for (SpStream stream : _streamVector) {
@@ -217,14 +218,14 @@ void StreamManager::checkForSessionTimeout() {
217218 }
218219}
219220
220- std::string StreamManager::getDescribeMediaLevelString (const FeID id ) const {
221+ std::string StreamManager::getDescribeMediaLevelString (const FeIndex feIndex ) const {
221222 assert (!_streamVector.empty ());
222- return _streamVector[id .getID ()]->getDescribeMediaLevelString ();
223+ return _streamVector[feIndex .getID ()]->getDescribeMediaLevelString ();
223224}
224225
225226#ifdef LIBDVBCSA
226- input::dvb::SpFrontendDecryptInterface StreamManager::getFrontendDecryptInterface (const FeID id ) {
227- return _streamVector[id .getID ()]->getFrontendDecryptInterface ();
227+ input::dvb::SpFrontendDecryptInterface StreamManager::getFrontendDecryptInterface (const FeIndex feIndex ) {
228+ return _streamVector[feIndex .getID ()]->getFrontendDecryptInterface ();
228229}
229230#endif
230231
0 commit comments