From 11046ae3daa246247cf671a4222599a90cb8fbcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20R=C3=A4s=C3=A4nen?= Date: Mon, 11 Jun 2018 09:39:14 +0300 Subject: [PATCH] Added the missing check for deleted peers at correct location. --- src/rtpstreamer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/rtpstreamer.cpp b/src/rtpstreamer.cpp index 5ea84078..f3778b9a 100644 --- a/src/rtpstreamer.cpp +++ b/src/rtpstreamer.cpp @@ -151,12 +151,19 @@ bool RTPStreamer::addPeer(in_addr ip, uint32_t sessionID) peer->audioSender = 0; peer->audioReceiver = 0; - while(peers_.size() < sessionID - 1) + if(peers_.size() >= sessionID && peers_.at(sessionID - 1) == NULL) { - peers_.append(NULL); + peers_[sessionID - 1] = peer; } + else + { + while(peers_.size() < sessionID - 1) + { + peers_.append(NULL); + } - peers_.push_back(peer); + peers_.push_back(peer); + } iniated_.unlock(); destroyed_.unlock();