예제 #1
0
int AudioMixerClientData::processPackets(ConcurrentAddedStreams& addedStreams) {
    SharedNodePointer node = _packetQueue.node;
    assert(_packetQueue.empty() || node);
    _packetQueue.node.clear();

    while (!_packetQueue.empty()) {
        auto& packet = _packetQueue.front();

        switch (packet->getType()) {
            case PacketType::MicrophoneAudioNoEcho:
            case PacketType::MicrophoneAudioWithEcho:
            case PacketType::InjectAudio:
            case PacketType::SilentAudioFrame: {
                if (node->isUpstream()) {
                    setupCodecForReplicatedAgent(packet);
                }

                processStreamPacket(*packet, addedStreams);

                optionallyReplicatePacket(*packet, *node);
                break;
            }
            case PacketType::AudioStreamStats: {
                parseData(*packet);
                break;
            }
            case PacketType::NegotiateAudioFormat:
                negotiateAudioFormat(*packet, node);
                break;
            case PacketType::RequestsDomainListData:
                parseRequestsDomainListData(*packet);
                break;
            case PacketType::PerAvatarGainSet:
                parsePerAvatarGainSet(*packet, node);
                break;
            case PacketType::NodeIgnoreRequest:
                parseNodeIgnoreRequest(packet, node);
                break;
            case PacketType::RadiusIgnoreRequest:
                parseRadiusIgnoreRequest(packet, node);
                break;
            case PacketType::AudioSoloRequest:
                parseSoloRequest(packet, node);
                break;
            default:
                Q_UNREACHABLE();
        }

        _packetQueue.pop();
    }
    assert(_packetQueue.empty());

    // now that we have processed all packets for this frame
    // we can prepare the sources from this client to be ready for mixing
    return checkBuffersBeforeFrameSend();
}
예제 #2
0
void AudioMixerClientData::processPackets() {
    SharedNodePointer node = _packetQueue.node;
    assert(_packetQueue.empty() || node);
    _packetQueue.node.clear();

    while (!_packetQueue.empty()) {
        auto& packet = _packetQueue.front();

        switch (packet->getType()) {
            case PacketType::MicrophoneAudioNoEcho:
            case PacketType::MicrophoneAudioWithEcho:
            case PacketType::InjectAudio:
            case PacketType::SilentAudioFrame: {

                if (node->isUpstream()) {
                    setupCodecForReplicatedAgent(packet);
                }

                QMutexLocker lock(&getMutex());
                parseData(*packet);

                optionallyReplicatePacket(*packet, *node);

                break;
            }
            case PacketType::AudioStreamStats: {
                QMutexLocker lock(&getMutex());
                parseData(*packet);

                break;
            }
            case PacketType::NegotiateAudioFormat:
                negotiateAudioFormat(*packet, node);
                break;
            case PacketType::RequestsDomainListData:
                parseRequestsDomainListData(*packet);
                break;
            case PacketType::PerAvatarGainSet:
                parsePerAvatarGainSet(*packet, node);
                break;
            case PacketType::NodeIgnoreRequest:
                parseNodeIgnoreRequest(packet, node);
                break;
            case PacketType::RadiusIgnoreRequest:
                parseRadiusIgnoreRequest(packet, node);
                break;
            default:
                Q_UNREACHABLE();
        }

        _packetQueue.pop();
    }
    assert(_packetQueue.empty());
}