mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
use packet version helpers for PACKET_TYPE_INJECT_AUDIO
This commit is contained in:
parent
c64a961a38
commit
8f7a3f3567
3 changed files with 7 additions and 7 deletions
|
@ -21,7 +21,7 @@ InjectedAudioRingBuffer::InjectedAudioRingBuffer() :
|
|||
}
|
||||
|
||||
int InjectedAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||
unsigned char* currentBuffer = sourceBuffer + sizeof(PACKET_TYPE_INJECT_AUDIO);
|
||||
unsigned char* currentBuffer = sourceBuffer + numBytesForPacketHeader(sourceBuffer);
|
||||
|
||||
// pull stream identifier from the packet
|
||||
memcpy(&_streamIdentifier, currentBuffer, sizeof(_streamIdentifier));
|
||||
|
|
|
@ -144,7 +144,8 @@ int main(int argc, char* argv[]) {
|
|||
nodeList->linkedDataCreateCallback = createAvatarDataForNode;
|
||||
|
||||
timeval lastSend = {};
|
||||
unsigned char broadcastPacket = PACKET_TYPE_INJECT_AUDIO;
|
||||
int numBytesPacketHeader = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_INJECT_AUDIO);
|
||||
unsigned char* broadcastPacket = new unsigned char[numBytesPacketHeader];
|
||||
|
||||
timeval lastDomainServerCheckIn = {};
|
||||
|
||||
|
@ -210,8 +211,8 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
// use the UDPSocket instance attached to our node list to ask avatar mixer for a list of avatars
|
||||
nodeList->getNodeSocket()->send(avatarMixer->getActiveSocket(),
|
||||
&broadcastPacket,
|
||||
sizeof(broadcastPacket));
|
||||
&broadcastPacket,
|
||||
numBytesPacketHeader);
|
||||
}
|
||||
} else {
|
||||
if (!injector.isInjectingAudio() && (::shouldLoopAudio || !::hasInjectedAudioOnce)) {
|
||||
|
|
|
@ -70,7 +70,7 @@ void AudioInjector::injectAudio(UDPSocket* injectorSocket, sockaddr* destination
|
|||
timeval startTime;
|
||||
|
||||
// calculate the number of bytes required for additional data
|
||||
int leadingBytes = sizeof(PACKET_TYPE)
|
||||
int leadingBytes = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_INJECT_AUDIO)
|
||||
+ sizeof(_streamIdentifier)
|
||||
+ sizeof(_position)
|
||||
+ sizeof(_orientation)
|
||||
|
@ -79,8 +79,7 @@ void AudioInjector::injectAudio(UDPSocket* injectorSocket, sockaddr* destination
|
|||
|
||||
unsigned char dataPacket[(BUFFER_LENGTH_SAMPLES_PER_CHANNEL * sizeof(int16_t)) + leadingBytes];
|
||||
|
||||
dataPacket[0] = PACKET_TYPE_INJECT_AUDIO;
|
||||
unsigned char *currentPacketPtr = dataPacket + sizeof(PACKET_TYPE_INJECT_AUDIO);
|
||||
unsigned char *currentPacketPtr = dataPacket + populateTypeAndVersion(dataPacket, PACKET_TYPE_INJECT_AUDIO);
|
||||
|
||||
// copy the identifier for this injector
|
||||
memcpy(currentPacketPtr, &_streamIdentifier, sizeof(_streamIdentifier));
|
||||
|
|
Loading…
Reference in a new issue