コード例 #1
0
void AudioMixerDatagramProcessor::readPendingDatagrams() {
    
    HifiSockAddr senderSockAddr;
    static QByteArray incomingPacket;
    
    // read everything that is available
    while (_nodeSocket.hasPendingDatagrams()) {
        incomingPacket.resize(_nodeSocket.pendingDatagramSize());
        
        // just get this packet off the stack
        _nodeSocket.readDatagram(incomingPacket.data(), incomingPacket.size(),
                                  senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
        
        // emit the signal to tell AudioMixer it needs to process a packet
        emit packetRequiresProcessing(incomingPacket, senderSockAddr);
    }
}
コード例 #2
0
void OctreeServerDatagramProcessor::readPendingDatagrams() {

    HifiSockAddr senderSockAddr;
    static QByteArray incomingPacket;

    // read everything that is available
    while (_nodeSocket.hasPendingDatagrams()) {
        incomingPacket.resize(_nodeSocket.pendingDatagramSize());

        // just get this packet off the stack
        _nodeSocket.readDatagram(incomingPacket.data(), incomingPacket.size(),
                                 senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());

        PacketType packetType = packetTypeForPacket(incomingPacket);
        if (packetType == PacketTypePing) {
            DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, incomingPacket);
            return; // don't emit
        }

        // emit the signal to tell AudioMixer it needs to process a packet
        emit packetRequiresProcessing(incomingPacket, senderSockAddr);
    }
}