diff --git a/src/conference/session/streams-group.cpp b/src/conference/session/streams-group.cpp index 14c9a148a1dae874cb7adf0ded197ada7f03e407..9403864333101b50824acd73dc5faaeb3d7f8ad2 100644 --- a/src/conference/session/streams-group.cpp +++ b/src/conference/session/streams-group.cpp @@ -111,8 +111,10 @@ void StreamsGroup::fillLocalMediaDescription(OfferAnswerContext ¶ms) { void StreamsGroup::createStreams(const OfferAnswerContext ¶ms) { size_t index; - const auto &localMd = params.localMediaDescription; - for (index = 0; index < localMd->streams.size(); ++index) { + // If the offer answer context has a remote media description, it means that we are replying to an INVITE, therefore + // we need to create only as many streams as the offer has + const auto &md = params.remoteMediaDescription ? params.remoteMediaDescription : params.localMediaDescription; + for (index = 0; index < md->streams.size(); ++index) { Stream *s = nullptr; params.scopeStreamToIndexWithDiff(index, mCurrentOfferAnswerState);