mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 01:15:46 +00:00
Fix buffer leak when the audio receive thread dies
This commit is contained in:
parent
a933886537
commit
cb43494cd0
@ -158,7 +158,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
if (packet == NULL) {
|
if (packet == NULL) {
|
||||||
Limelog("Audio Receive: malloc() failed\n");
|
Limelog("Audio Receive: malloc() failed\n");
|
||||||
ListenerCallbacks.connectionTerminated(-1);
|
ListenerCallbacks.connectionTerminated(-1);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
Limelog("Audio Receive: recv() failed: %d\n", (int)LastSocketError());
|
Limelog("Audio Receive: recv() failed: %d\n", (int)LastSocketError());
|
||||||
free(packet);
|
free(packet);
|
||||||
ListenerCallbacks.connectionTerminated(LastSocketError());
|
ListenerCallbacks.connectionTerminated(LastSocketError());
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet->size < sizeof(RTP_PACKET)) {
|
if (packet->size < sizeof(RTP_PACKET)) {
|
||||||
@ -189,7 +189,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
if ((AudioCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
if ((AudioCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||||
if (!queuePacketToLbq(&packet)) {
|
if (!queuePacketToLbq(&packet)) {
|
||||||
// An exit signal was received
|
// An exit signal was received
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -208,16 +208,25 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
if ((AudioCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
if ((AudioCallbacks.capabilities & CAPABILITY_DIRECT_SUBMIT) == 0) {
|
||||||
if (!queuePacketToLbq(&packet)) {
|
if (!queuePacketToLbq(&packet)) {
|
||||||
// An exit signal was received
|
// An exit signal was received
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
decodeInputData(packet);
|
decodeInputData(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Break on exit
|
||||||
|
if (packet != NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packet != NULL) {
|
||||||
|
free(packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DecoderThreadProc(void* context) {
|
static void DecoderThreadProc(void* context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user