Merge pull request #1563 from birarda/master

have muting also mute local loopback, NodeList tweak
This commit is contained in:
Andrzej Kapolka 2014-01-16 16:37:47 -08:00
commit c93e70e3cb
2 changed files with 16 additions and 17 deletions

View file

@ -297,7 +297,7 @@ void Audio::handleAudioInput() {
QByteArray inputByteArray = _inputDevice->readAll(); QByteArray inputByteArray = _inputDevice->readAll();
if (Menu::getInstance()->isOptionChecked(MenuOption::EchoLocalAudio)) { if (Menu::getInstance()->isOptionChecked(MenuOption::EchoLocalAudio) && !_muted) {
// if this person wants local loopback add that to the locally injected audio // if this person wants local loopback add that to the locally injected audio
if (!_loopbackOutputDevice) { if (!_loopbackOutputDevice) {

View file

@ -674,9 +674,9 @@ void NodeList::pingPublicAndLocalSocketsForInactiveNode(Node* node) {
SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType, SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket) { const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket) {
NodeHash::iterator matchingNodeItem = _nodeHash.find(uuid); SharedNodePointer matchingNode = _nodeHash.value(uuid);
if (matchingNodeItem == _nodeHash.end()) { if (!matchingNode) {
// we didn't have this node, so add them // we didn't have this node, so add them
Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket); Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket);
SharedNodePointer newNodeSharedPointer(newNode, &QObject::deleteLater); SharedNodePointer newNodeSharedPointer(newNode, &QObject::deleteLater);
@ -689,29 +689,28 @@ SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
return newNodeSharedPointer; return newNodeSharedPointer;
} else { } else {
SharedNodePointer node = matchingNodeItem.value(); QMutexLocker(&matchingNode->getMutex());
QMutexLocker(&node->getMutex());
if (node->getType() == NODE_TYPE_AUDIO_MIXER || if (matchingNode->getType() == NODE_TYPE_AUDIO_MIXER ||
node->getType() == NODE_TYPE_VOXEL_SERVER || matchingNode->getType() == NODE_TYPE_VOXEL_SERVER ||
node->getType() == NODE_TYPE_METAVOXEL_SERVER) { matchingNode->getType() == NODE_TYPE_METAVOXEL_SERVER) {
// until the Audio class also uses our nodeList, we need to update // until the Audio class also uses our nodeList, we need to update
// the lastRecvTimeUsecs for the audio mixer so it doesn't get killed and re-added continously // the lastRecvTimeUsecs for the audio mixer so it doesn't get killed and re-added continously
node->setLastHeardMicrostamp(usecTimestampNow()); matchingNode->setLastHeardMicrostamp(usecTimestampNow());
} }
// check if we need to change this node's public or local sockets // check if we need to change this node's public or local sockets
if (publicSocket != node->getPublicSocket()) { if (publicSocket != matchingNode->getPublicSocket()) {
node->setPublicSocket(publicSocket); matchingNode->setPublicSocket(publicSocket);
qDebug() << "Public socket change for node" << *node; qDebug() << "Public socket change for node" << *matchingNode;
} }
if (localSocket != node->getLocalSocket()) { if (localSocket != matchingNode->getLocalSocket()) {
node->setLocalSocket(localSocket); matchingNode->setLocalSocket(localSocket);
qDebug() << "Local socket change for node" << *node; qDebug() << "Local socket change for node" << *matchingNode;
} }
// we had this node already, do nothing for now // we had this node already, do nothing for now
return node; return matchingNode;
} }
} }