From 4270cfe2b49101690f211065afab1f8c6ea32027 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 13 Feb 2013 16:14:04 -0800 Subject: [PATCH] send client their own packet for solo mixer testing --- mixer/src/main.cpp | 9 +++++---- shared/src/UDPSocket.cpp | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mixer/src/main.cpp b/mixer/src/main.cpp index ffc6fa7c33..9dce08fc94 100644 --- a/mixer/src/main.cpp +++ b/mixer/src/main.cpp @@ -171,10 +171,11 @@ void *sendBuffer(void *args) } for(int as = 0; as < BUFFER_LENGTH_SAMPLES; as++) { - long longSample = previousOutput != NULL - ? masterMix[as] - previousOutput[as] - : masterMix[as]; +// long longSample = previousOutput != NULL +// ? masterMix[as] - previousOutput[as] +// : masterMix[as]; + long longSample = masterMix[as]; int16_t shortSample; @@ -195,7 +196,7 @@ void *sendBuffer(void *args) } - sentBytes = audioSocket->send(agents[a].address, agents[a].port, (void *) clientMix, BUFFER_LENGTH_BYTES); + sentBytes = audioSocket->send(agents[a].address, agents[a].port, clientMix, BUFFER_LENGTH_BYTES); if (sentBytes < BUFFER_LENGTH_BYTES) { std::cout << "Error sending mix packet! " << sentBytes << strerror(errno) << "\n"; diff --git a/shared/src/UDPSocket.cpp b/shared/src/UDPSocket.cpp index 2fdbb2f0b7..edff5740ff 100644 --- a/shared/src/UDPSocket.cpp +++ b/shared/src/UDPSocket.cpp @@ -51,10 +51,7 @@ UDPSocket::~UDPSocket() { // Receive data on this socket with retrieving address of sender bool UDPSocket::receive(void *receivedData, int *receivedBytes) { - *receivedBytes = recvfrom(handle, receivedData, MAX_BUFFER_LENGTH_BYTES, - 0, (sockaddr *)&senderAddress, &addLength); - - return (*receivedBytes > 0); + return receive(&senderAddress, receivedData, receivedBytes); } // Receive data on this socket with the address of the sender