1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(groups): add peers if already playing audio when netcam created

This commit is contained in:
Anthony Bilinski 2019-03-04 23:15:51 -08:00
parent 7c13b8b7db
commit e489168775
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -381,12 +381,12 @@ void GroupChatForm::peerAudioPlaying(ToxPk peerPk)
delete peerAudioTimers[peerPk];
peerAudioTimers[peerPk] = nullptr;
});
}
if (netcam) {
static_cast<GroupNetCamView*>(netcam)->removePeer(peerPk);
const auto nameIt = group->getPeerList().find(peerPk);
static_cast<GroupNetCamView*>(netcam)->addPeer(peerPk, nameIt.value());
}
}
peerLabels[peerPk]->setStyleSheet(Style::getStylesheet(PEER_LABEL_STYLE_SHEET_PATH));
peerAudioTimers[peerPk]->start(500);
@ -466,8 +466,17 @@ void GroupChatForm::onCallClicked()
GenericNetCamView* GroupChatForm::createNetcam()
{
// leave view empty, it will pe populated once we receive audio from peers
return new GroupNetCamView(group->getId(), this);
auto view = new GroupNetCamView(group->getId(), this);
const auto& names = group->getPeerList();
const auto ownPk = Core::getInstance()->getSelfPublicKey();
for (const auto& peerPk : names.keys()) {
auto timerIt = peerAudioTimers.find(peerPk);
if (peerPk != ownPk && timerIt != peerAudioTimers.end()) {
static_cast<GroupNetCamView*>(view)->addPeer(peerPk, names.find(peerPk).value());
}
}
return view;
}
void GroupChatForm::keyPressEvent(QKeyEvent* ev)