Skip to content

Commit

Permalink
trying numeric_limit for user instead of 0
Browse files Browse the repository at this point in the history
  • Loading branch information
taraldv committed Aug 1, 2020
1 parent a5ffd65 commit ab4d47c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions handlers/imagehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ QImage ImageHandler::requestImage(const QString &id, QSize *size, const QSize &r
void ImageHandler::addPeer(uint8_t index, QString displayName)
{
qDebug() << "Added peer to ImageHandler map: " << index;
imgLock.lock();
mImageMap[index].first = generateGenericImage(displayName);
mImageMap[index].second = displayName;
imgLock.unlock();
emit refreshScreens();
}

void ImageHandler::removeAllPeers()
{
qDebug() << "Removing all peers";
imgLock.lock();
mImageMap.clear();
imgLock.unlock();
}

/**
Expand All @@ -75,9 +79,9 @@ void ImageHandler::removeAllPeers()
void ImageHandler::removePeer(uint8_t index)
{
qDebug() << "Removing peer from ImageHandler map: " << index;

mImageMap.erase(index+1);

imgLock.lock();
mImageMap.erase(index);
imgLock.unlock();
emit refreshScreens();
}

Expand Down
6 changes: 3 additions & 3 deletions handlers/inputstreamhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void InputStreamHandler::addStreamToVector(int index, QString streamId, QString
mAudioPlaybackStartedVector.push_back(false);
mVideoPlaybackStartedVector.push_back(false);

//Your own image is at 0, but index 0 in the vectors is NOT you.
mImageHandler->addPeer((index + 1), displayName);
//Your own image is at numeric limit for uint8, so we have a problem if a room gets that many participants
mImageHandler->addPeer(index, displayName);
}

/**
Expand Down Expand Up @@ -204,7 +204,7 @@ int InputStreamHandler::findStreamIdIndex(QString streamId, QString displayName)

void InputStreamHandler::updateParticipantDisplayName(QString streamId, QString displayName)
{
uint8_t index = findStreamIdIndex(streamId, displayName) + 1;
uint8_t index = findStreamIdIndex(streamId, displayName);
mImageHandler->updatePeerDisplayName(index, displayName);
}

Expand Down

0 comments on commit ab4d47c

Please sign in to comment.