mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 00:19:37 +02:00
PR feedback
Completely deleting hrtfs incorrectly. This seems to be better, we only want to delete HRTF for the QUuid() stream for the killed node in each node's list of HRTFs.
This commit is contained in:
parent
c1feac971b
commit
ec0382daf7
4 changed files with 16 additions and 25 deletions
assignment-client/src
|
@ -424,9 +424,9 @@ void Agent::setIsListeningToAudioStream(bool isListeningToAudioStream) {
|
|||
},
|
||||
[&](const SharedNodePointer& node) {
|
||||
qDebug() << "sending KillAvatar message to Audio Mixers";
|
||||
auto packetList = NLPacketList::create(PacketType::KillAvatar, QByteArray(), true, true);
|
||||
packetList->write(getSessionUUID().toRfc4122());
|
||||
nodeList->sendPacketList(std::move(packetList), *node);
|
||||
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID);
|
||||
packet->write(getSessionUUID().toRfc4122());
|
||||
nodeList->sendPacket(std::move(packet), *node);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -475,9 +475,9 @@ void Agent::setIsAvatar(bool isAvatar) {
|
|||
},
|
||||
[&](const SharedNodePointer& node) {
|
||||
qDebug() << "sending KillAvatar message to Avatar and Audio Mixers";
|
||||
auto packetList = NLPacketList::create(PacketType::KillAvatar, QByteArray(), true, true);
|
||||
packetList->write(getSessionUUID().toRfc4122());
|
||||
nodeList->sendPacketList(std::move(packetList), *node);
|
||||
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID);
|
||||
packet->write(getSessionUUID().toRfc4122());
|
||||
nodeList->sendPacket(std::move(packet), *node);
|
||||
});
|
||||
}
|
||||
emit stopAvatarAudioTimer();
|
||||
|
|
|
@ -602,16 +602,14 @@ void AudioMixer::handleNodeKilled(SharedNodePointer killedNode) {
|
|||
void AudioMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
||||
auto clientData = dynamic_cast<AudioMixerClientData*>(sendingNode->getLinkedData());
|
||||
if (clientData) {
|
||||
QUuid streamID = clientData->removeAgentAvatarAudioStream();
|
||||
if (streamID != QUuid()) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->eachNode([sendingNode, &streamID](const SharedNodePointer& node){
|
||||
auto listenerClientData = dynamic_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||
if (listenerClientData) {
|
||||
listenerClientData->removeHRTFForStream(sendingNode->getUUID(), streamID);
|
||||
}
|
||||
});
|
||||
}
|
||||
clientData->removeAgentAvatarAudioStream();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->eachNode([sendingNode](const SharedNodePointer& node){
|
||||
auto listenerClientData = dynamic_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||
if (listenerClientData) {
|
||||
listenerClientData->removeHRTFForStream(sendingNode->getUUID(), QUuid());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,20 +73,13 @@ void AudioMixerClientData::removeHRTFForStream(const QUuid& nodeID, const QUuid&
|
|||
}
|
||||
}
|
||||
|
||||
QUuid AudioMixerClientData::removeAgentAvatarAudioStream() {
|
||||
void AudioMixerClientData::removeAgentAvatarAudioStream() {
|
||||
QWriteLocker writeLocker { &_streamsLock };
|
||||
QUuid streamId;
|
||||
auto it = _audioStreams.find(QUuid());
|
||||
if (it != _audioStreams.end()) {
|
||||
AvatarAudioStream* stream = dynamic_cast<AvatarAudioStream*>(it->second.get());
|
||||
if (stream) {
|
||||
streamId = stream->getStreamIdentifier();
|
||||
}
|
||||
_audioStreams.erase(it);
|
||||
}
|
||||
writeLocker.unlock();
|
||||
|
||||
return streamId;
|
||||
}
|
||||
|
||||
int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
// removes an AudioHRTF object for a given stream
|
||||
void removeHRTFForStream(const QUuid& nodeID, const QUuid& streamID = QUuid());
|
||||
|
||||
QUuid removeAgentAvatarAudioStream();
|
||||
void removeAgentAvatarAudioStream();
|
||||
|
||||
int parseData(ReceivedMessage& message) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue