@@ -125,29 +125,30 @@ std::string StreamManager::getRTSPDescribeString() const {
125
125
return StringConverter::stringFormat (" @#1,@#2,@#3" , dvb_s2, dvb_t + dvb_t2, dvb_c + dvb_c2);
126
126
}
127
127
128
- FeID StreamManager::findFrontendIDWithStreamID (const StreamID id) const {
128
+ std::tuple<FeIndex, FeID> StreamManager::findFrontendIDWithStreamID (const StreamID id) const {
129
129
for (SpStream stream : _streamVector) {
130
130
if (stream->getStreamID () == id) {
131
- return stream->getFeID ();
131
+ return { stream->getFeIndex (), stream-> getFeID () } ;
132
132
}
133
133
}
134
- return FeID ();
134
+ return { FeIndex (), FeID () } ;
135
135
}
136
136
137
- std::pair< FeID, StreamID> StreamManager::findFrontendID (const TransportParamVector& params) const {
137
+ std::tuple<FeIndex, FeID, StreamID> StreamManager::findFrontendID (const TransportParamVector& params) const {
138
138
const StreamID streamID = params.getIntParameter (" stream" );
139
- const FeID feID = params.getIntParameter (" fe" );
139
+ FeID feID = params.getIntParameter (" fe" );
140
140
// Did we find StreamID an NO FrondendID
141
141
if (streamID != -1 && feID == -1 ) {
142
- return { findFrontendIDWithStreamID (streamID), streamID };
142
+ const auto [index , feID] = findFrontendIDWithStreamID (streamID);
143
+ return { index , feID, streamID };
143
144
}
144
145
// Is the requested FrondendID in range, then return this
145
146
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 };
148
149
}
149
- // Out of range, return -1, -1
150
- return { FeID (), StreamID () };
150
+ // Out of range, return -1, -1, -1
151
+ return { FeIndex (), FeID (), StreamID () };
151
152
}
152
153
153
154
SpStream StreamManager::findStreamAndClientIDFor (SocketClient &socketClient, int &clientID) {
@@ -156,8 +157,8 @@ SpStream StreamManager::findStreamAndClientIDFor(SocketClient &socketClient, int
156
157
HeaderVector headers = socketClient.getHeaders ();
157
158
TransportParamVector params = socketClient.getTransportParameters ();
158
159
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);
161
162
162
163
std::string sessionID = headers.getFieldParameter (" Session" );
163
164
bool newSession = false ;
@@ -179,8 +180,8 @@ SpStream StreamManager::findStreamAndClientIDFor(SocketClient &socketClient, int
179
180
}
180
181
}
181
182
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 ) {
184
185
SI_LOG_INFO (" Found FrondtendID: x (fe=x) StreamID: x SessionID: @#1" , sessionID);
185
186
for (SpStream stream : _streamVector) {
186
187
if (stream->findClientIDFor (socketClient, newSession, sessionID, clientID)) {
@@ -189,11 +190,11 @@ SpStream StreamManager::findStreamAndClientIDFor(SocketClient &socketClient, int
189
190
}
190
191
}
191
192
} 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);
193
194
// 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 ];
197
198
}
198
199
// No, Then try to search in other Streams
199
200
for (SpStream stream : _streamVector) {
@@ -217,14 +218,14 @@ void StreamManager::checkForSessionTimeout() {
217
218
}
218
219
}
219
220
220
- std::string StreamManager::getDescribeMediaLevelString (const FeID id ) const {
221
+ std::string StreamManager::getDescribeMediaLevelString (const FeIndex feIndex ) const {
221
222
assert (!_streamVector.empty ());
222
- return _streamVector[id .getID ()]->getDescribeMediaLevelString ();
223
+ return _streamVector[feIndex .getID ()]->getDescribeMediaLevelString ();
223
224
}
224
225
225
226
#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 ();
228
229
}
229
230
#endif
230
231
0 commit comments