From 3f3cc89b8d0a9408fc94fc2f0bb4e7ba978eae44 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 13 Jun 2017 11:58:08 -0700 Subject: [PATCH] fix for header of re-replicated packets --- .../src/audio/AudioMixerClientData.cpp | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/assignment-client/src/audio/AudioMixerClientData.cpp b/assignment-client/src/audio/AudioMixerClientData.cpp index 3942c3177b..848dc969d8 100644 --- a/assignment-client/src/audio/AudioMixerClientData.cpp +++ b/assignment-client/src/audio/AudioMixerClientData.cpp @@ -109,6 +109,13 @@ void AudioMixerClientData::processPackets() { assert(_packetQueue.empty()); } +bool isReplicatedPacket(PacketType packetType) { + return packetType == PacketType::ReplicatedMicrophoneAudioNoEcho + || packetType == PacketType::ReplicatedMicrophoneAudioWithEcho + || packetType == PacketType::ReplicatedInjectAudio + || packetType == PacketType::ReplicatedSilentAudioFrame; +} + void AudioMixerClientData::optionallyReplicatePacket(ReceivedMessage& message, const Node& node) { // first, make sure that this is a packet from a node we are supposed to replicate @@ -126,7 +133,7 @@ void AudioMixerClientData::optionallyReplicatePacket(ReceivedMessage& message, c break; case PacketType::MicrophoneAudioWithEcho: case PacketType::ReplicatedMicrophoneAudioWithEcho: - mirroredType = PacketType::ReplicatedMicrophoneAudioWithEcho; + mirroredType = PacketType::ReplicatedMicrophoneAudioWithEcho; break; case PacketType::InjectAudio: case PacketType::ReplicatedInjectAudio: @@ -150,12 +157,14 @@ void AudioMixerClientData::optionallyReplicatePacket(ReceivedMessage& message, c // construct an NLPacket to send to the replicant that has the contents of the received packet packet = NLPacket::create(mirroredType); - // since this packet will be non-sourced, we add the replicated node's ID here - packet->write(node.getUUID().toRfc4122()); + if (!isReplicatedPacket(message.getType())) { + // since this packet will be non-sourced, we add the replicated node's ID here + packet->write(node.getUUID().toRfc4122()); - // we won't negotiate an audio format with the replicant, because we aren't a listener - // so pack the codec string here so that it can statelessly setup a decoder for this string when it needs - packet->writeString(_selectedCodecName); + // we won't negotiate an audio format with the replicant, because we aren't a listener + // so pack the codec string here so that it can statelessly setup a decoder for this string when it needs + packet->writeString(_selectedCodecName); + } packet->write(message.getMessage()); }