Skip to content

Commit

Permalink
Added the missing check for deleted peers at correct location.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrsnen committed Jun 11, 2018
1 parent 3d6fda7 commit 11046ae
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/rtpstreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 11046ae

Please sign in to comment.