fix primitive type writing in AudioClient

This commit is contained in:
Stephen Birarda 2015-07-08 16:46:08 -07:00
parent f37d3c9bd6
commit 546268be55

View file

@ -843,12 +843,12 @@ void AudioClient::handleAudioInput() {
quint8 isStereo = _isStereoInput ? 1 : 0; quint8 isStereo = _isStereoInput ? 1 : 0;
if (_lastInputLoudness == 0) { if (_lastInputLoudness == 0) {
_audioPacket->setPacketType(PacketType::SilentAudioFrame); _audioPacket->setType(PacketType::SilentAudioFrame);
} else { } else {
if (_shouldEchoToServer) { if (_shouldEchoToServer) {
_audioPacket->setPacketType(PacketType::MicrophoneAudioWithEcho); _audioPacket->setType(PacketType::MicrophoneAudioWithEcho);
} else { } else {
_audioPacket->setPacketType(PacketType::MicrophoneAudioNoEcho); _audioPacket->setType(PacketType::MicrophoneAudioNoEcho);
} }
} }
@ -861,17 +861,17 @@ void AudioClient::handleAudioInput() {
if (_audioPacket->getPacketType() == PacketType::SilentAudioFrame) { if (_audioPacket->getPacketType() == PacketType::SilentAudioFrame) {
// pack num silent samples // pack num silent samples
quint16 numSilentSamples = numNetworkSamples; quint16 numSilentSamples = numNetworkSamples;
_audioPacket->write(numSilentSamples); _audioPacket->writePrimitive(numSilentSamples);
} else { } else {
// set the mono/stereo byte // set the mono/stereo byte
_audioPacket->write(isStereo); _audioPacket->writePrimitive(isStereo);
} }
// pack the three float positions // pack the three float positions
_audioPacket->write(headPosition); _audioPacket->writePrimitive(headPosition);
// pack the orientation // pack the orientation
_audioPacket->write(headOrientation); _audioPacket->writePrimitive(headOrientation);
if (_audioPacket->getPacketType() != PacketType::SilentAudioFrame) { if (_audioPacket->getPacketType() != PacketType::SilentAudioFrame) {
// audio samples have already been packed (written to networkAudioSamples) // audio samples have already been packed (written to networkAudioSamples)