mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +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
|
@ -424,9 +424,9 @@ void Agent::setIsListeningToAudioStream(bool isListeningToAudioStream) {
|
||||||
},
|
},
|
||||||
[&](const SharedNodePointer& node) {
|
[&](const SharedNodePointer& node) {
|
||||||
qDebug() << "sending KillAvatar message to Audio Mixers";
|
qDebug() << "sending KillAvatar message to Audio Mixers";
|
||||||
auto packetList = NLPacketList::create(PacketType::KillAvatar, QByteArray(), true, true);
|
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID);
|
||||||
packetList->write(getSessionUUID().toRfc4122());
|
packet->write(getSessionUUID().toRfc4122());
|
||||||
nodeList->sendPacketList(std::move(packetList), *node);
|
nodeList->sendPacket(std::move(packet), *node);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -475,9 +475,9 @@ void Agent::setIsAvatar(bool isAvatar) {
|
||||||
},
|
},
|
||||||
[&](const SharedNodePointer& node) {
|
[&](const SharedNodePointer& node) {
|
||||||
qDebug() << "sending KillAvatar message to Avatar and Audio Mixers";
|
qDebug() << "sending KillAvatar message to Avatar and Audio Mixers";
|
||||||
auto packetList = NLPacketList::create(PacketType::KillAvatar, QByteArray(), true, true);
|
auto packet = NLPacket::create(PacketType::KillAvatar, NUM_BYTES_RFC4122_UUID);
|
||||||
packetList->write(getSessionUUID().toRfc4122());
|
packet->write(getSessionUUID().toRfc4122());
|
||||||
nodeList->sendPacketList(std::move(packetList), *node);
|
nodeList->sendPacket(std::move(packet), *node);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
emit stopAvatarAudioTimer();
|
emit stopAvatarAudioTimer();
|
||||||
|
|
|
@ -602,16 +602,14 @@ void AudioMixer::handleNodeKilled(SharedNodePointer killedNode) {
|
||||||
void AudioMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
void AudioMixer::handleKillAvatarPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode) {
|
||||||
auto clientData = dynamic_cast<AudioMixerClientData*>(sendingNode->getLinkedData());
|
auto clientData = dynamic_cast<AudioMixerClientData*>(sendingNode->getLinkedData());
|
||||||
if (clientData) {
|
if (clientData) {
|
||||||
QUuid streamID = clientData->removeAgentAvatarAudioStream();
|
clientData->removeAgentAvatarAudioStream();
|
||||||
if (streamID != QUuid()) {
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
nodeList->eachNode([sendingNode](const SharedNodePointer& node){
|
||||||
nodeList->eachNode([sendingNode, &streamID](const SharedNodePointer& node){
|
auto listenerClientData = dynamic_cast<AudioMixerClientData*>(node->getLinkedData());
|
||||||
auto listenerClientData = dynamic_cast<AudioMixerClientData*>(node->getLinkedData());
|
if (listenerClientData) {
|
||||||
if (listenerClientData) {
|
listenerClientData->removeHRTFForStream(sendingNode->getUUID(), QUuid());
|
||||||
listenerClientData->removeHRTFForStream(sendingNode->getUUID(), streamID);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,20 +73,13 @@ void AudioMixerClientData::removeHRTFForStream(const QUuid& nodeID, const QUuid&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid AudioMixerClientData::removeAgentAvatarAudioStream() {
|
void AudioMixerClientData::removeAgentAvatarAudioStream() {
|
||||||
QWriteLocker writeLocker { &_streamsLock };
|
QWriteLocker writeLocker { &_streamsLock };
|
||||||
QUuid streamId;
|
|
||||||
auto it = _audioStreams.find(QUuid());
|
auto it = _audioStreams.find(QUuid());
|
||||||
if (it != _audioStreams.end()) {
|
if (it != _audioStreams.end()) {
|
||||||
AvatarAudioStream* stream = dynamic_cast<AvatarAudioStream*>(it->second.get());
|
|
||||||
if (stream) {
|
|
||||||
streamId = stream->getStreamIdentifier();
|
|
||||||
}
|
|
||||||
_audioStreams.erase(it);
|
_audioStreams.erase(it);
|
||||||
}
|
}
|
||||||
writeLocker.unlock();
|
writeLocker.unlock();
|
||||||
|
|
||||||
return streamId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
// removes an AudioHRTF object for a given stream
|
// removes an AudioHRTF object for a given stream
|
||||||
void removeHRTFForStream(const QUuid& nodeID, const QUuid& streamID = QUuid());
|
void removeHRTFForStream(const QUuid& nodeID, const QUuid& streamID = QUuid());
|
||||||
|
|
||||||
QUuid removeAgentAvatarAudioStream();
|
void removeAgentAvatarAudioStream();
|
||||||
|
|
||||||
int parseData(ReceivedMessage& message) override;
|
int parseData(ReceivedMessage& message) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue