mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 01:03:59 +02:00
fix crash by closing socket before deleting audio data
This commit is contained in:
parent
52c410a65d
commit
b3375c5e5f
3 changed files with 7 additions and 1 deletions
|
@ -39,6 +39,7 @@ AudioData::~AudioData() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
delete[] samplesToQueue;
|
||||
|
||||
delete audioSocket;
|
||||
}
|
|
@ -51,6 +51,10 @@ UDPSocket::UDPSocket(int listeningPort) {
|
|||
printf("Created UDP socket listening on port %d.\n", listeningPort);
|
||||
}
|
||||
|
||||
UDPSocket::~UDPSocket() {
|
||||
close(handle);
|
||||
}
|
||||
|
||||
bool UDPSocket::receive(void *receivedData, int *receivedBytes) {
|
||||
|
||||
*receivedBytes = recvfrom(handle, receivedData, MAX_BUFFER_LENGTH_BYTES,
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
class UDPSocket {
|
||||
public:
|
||||
UDPSocket(int listening_port);
|
||||
~UDPSocket();
|
||||
int send(char *destAddress, int destPort, const void *data, int byteLength);
|
||||
bool receive(void *receivedData, int *receivedBytes);
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue