mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 00:03:16 +02:00
use packet version helpers in parseData methods
This commit is contained in:
parent
8f7a3f3567
commit
81e6bccd08
4 changed files with 10 additions and 5 deletions
|
@ -22,7 +22,7 @@ PositionalAudioRingBuffer::PositionalAudioRingBuffer() :
|
|||
}
|
||||
|
||||
int PositionalAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
unsigned char* currentBuffer = sourceBuffer + sizeof(PACKET_TYPE);
|
||||
unsigned char* currentBuffer = sourceBuffer + numBytesForPacketHeader(sourceBuffer);
|
||||
currentBuffer += parsePositionalData(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
||||
currentBuffer += parseAudioSamples(currentBuffer, numBytes - (currentBuffer - sourceBuffer));
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include <GeometryUtil.h>
|
||||
#include <PacketHeaders.h>
|
||||
#include <SharedUtil.h>
|
||||
|
||||
#include "Camera.h"
|
||||
|
@ -138,8 +139,10 @@ bool Environment::findCapsulePenetration(const glm::vec3& start, const glm::vec3
|
|||
int Environment::parseData(sockaddr *senderAddress, unsigned char* sourceBuffer, int numBytes) {
|
||||
// push past the packet header
|
||||
unsigned char* start = sourceBuffer;
|
||||
sourceBuffer++;
|
||||
numBytes--;
|
||||
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer);
|
||||
sourceBuffer += numBytesPacketHeader;
|
||||
numBytes -= numBytesPacketHeader;
|
||||
|
||||
// get the lock for the duration of the call
|
||||
QMutexLocker locker(&_mutex);
|
||||
|
|
|
@ -34,7 +34,8 @@ void AudioRingBuffer::reset() {
|
|||
}
|
||||
|
||||
int AudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
return parseAudioSamples(sourceBuffer + sizeof(PACKET_TYPE_MIXED_AUDIO), numBytes - sizeof(PACKET_TYPE_MIXED_AUDIO));
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer);
|
||||
return parseAudioSamples(sourceBuffer + numBytesPacketHeader, numBytes - numBytesPacketHeader);
|
||||
}
|
||||
|
||||
int AudioRingBuffer::parseAudioSamples(unsigned char* sourceBuffer, int numBytes) {
|
||||
|
|
|
@ -169,7 +169,8 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
}
|
||||
|
||||
// increment to push past the packet header
|
||||
sourceBuffer += sizeof(PACKET_TYPE) + sizeof(PACKET_VERSION);
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(sourceBuffer);
|
||||
sourceBuffer += numBytesPacketHeader;
|
||||
|
||||
unsigned char* startPosition = sourceBuffer;
|
||||
|
||||
|
|
Loading…
Reference in a new issue