Commit b3f24d2d authored by François Grisez's avatar François Grisez

MediaSession: fix getMediaStream(LinphoneStreamType) and getStreamIndex(LinphoneStreamType)

* getMediaStream() was deducing the index of the stream by casting the stream type into integer,
  which was wrong since the steams can be reordered on first incoming INVITE parsing.
  Fixed by using getStreamIndex(LinphoneStreamType) instead of cast.

* getStreamIndex() had to be rewriten because it was using getMediaStream(), which would
  cause infinite recursive calls.
parent 66fb0e53
......@@ -589,7 +589,7 @@ void MediaSessionPrivate::setRemoteParams (MediaSessionParams *msp) {
}
MediaStream *MediaSessionPrivate::getMediaStream (LinphoneStreamType type) const {
return getMediaStream(int(type));
return getMediaStream(getStreamIndex(type));
}
int MediaSessionPrivate::getRtcpPort (LinphoneStreamType type) const {
......@@ -615,7 +615,14 @@ LinphoneCallStats * MediaSessionPrivate::getStats (LinphoneStreamType type) cons
}
int MediaSessionPrivate::getStreamIndex (LinphoneStreamType type) const {
return getStreamIndex(getMediaStream(type));
switch (type) {
case LinphoneStreamTypeAudio: return mainAudioStreamIndex;
case LinphoneStreamTypeVideo: return mainVideoStreamIndex;
case LinphoneStreamTypeText: return mainTextStreamIndex;
case LinphoneStreamTypeUnknown: break;
}
lError() << __func__ << "(LinphoneStreamType): invalid stream type [" << type << "]";
return -1;
}
int MediaSessionPrivate::getStreamIndex (MediaStream *ms) const {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment