mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 14:21:30 +00:00
Improve logging of video/audio delay and errors
This commit is contained in:
+7
-1
@@ -132,6 +132,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
int queueStatus;
|
int queueStatus;
|
||||||
int useSelect;
|
int useSelect;
|
||||||
int packetsToDrop = 500 / AudioPacketDuration;
|
int packetsToDrop = 500 / AudioPacketDuration;
|
||||||
|
int waitingForAudioMs;
|
||||||
|
|
||||||
packet = NULL;
|
packet = NULL;
|
||||||
|
|
||||||
@@ -144,6 +145,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
useSelect = 0;
|
useSelect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitingForAudioMs = 0;
|
||||||
while (!PltIsThreadInterrupted(&receiveThread)) {
|
while (!PltIsThreadInterrupted(&receiveThread)) {
|
||||||
if (packet == NULL) {
|
if (packet == NULL) {
|
||||||
packet = (PQUEUED_AUDIO_PACKET)malloc(sizeof(*packet));
|
packet = (PQUEUED_AUDIO_PACKET)malloc(sizeof(*packet));
|
||||||
@@ -162,6 +164,10 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
}
|
}
|
||||||
else if (packet->size == 0) {
|
else if (packet->size == 0) {
|
||||||
// Receive timed out; try again
|
// Receive timed out; try again
|
||||||
|
|
||||||
|
if (!receivedDataFromPeer) {
|
||||||
|
waitingForAudioMs += UDP_RECV_POLL_TIMEOUT_MS;
|
||||||
|
}
|
||||||
|
|
||||||
// If we hit this path, there are no queued audio packets on the host PC,
|
// If we hit this path, there are no queued audio packets on the host PC,
|
||||||
// so we don't need to drop anything.
|
// so we don't need to drop anything.
|
||||||
@@ -184,7 +190,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
// We've received data, so we can stop sending our ping packets
|
// We've received data, so we can stop sending our ping packets
|
||||||
// as quickly, since we're now just keeping the NAT session open.
|
// as quickly, since we're now just keeping the NAT session open.
|
||||||
receivedDataFromPeer = 1;
|
receivedDataFromPeer = 1;
|
||||||
Limelog("Received first audio packet\n");
|
Limelog("Received first audio packet after %d ms\n", waitingForAudioMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GFE accumulates audio samples before we are ready to receive them,
|
// GFE accumulates audio samples before we are ready to receive them,
|
||||||
|
|||||||
+2
-1
@@ -115,6 +115,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
// assume something is broken and terminate the connection.
|
// assume something is broken and terminate the connection.
|
||||||
waitingForVideoMs += UDP_RECV_POLL_TIMEOUT_MS;
|
waitingForVideoMs += UDP_RECV_POLL_TIMEOUT_MS;
|
||||||
if (waitingForVideoMs >= FIRST_FRAME_TIMEOUT_SEC * 1000) {
|
if (waitingForVideoMs >= FIRST_FRAME_TIMEOUT_SEC * 1000) {
|
||||||
|
Limelog("Terminating connection due to lack of video traffic\n");
|
||||||
ListenerCallbacks.connectionTerminated(ML_ERROR_NO_VIDEO_TRAFFIC);
|
ListenerCallbacks.connectionTerminated(ML_ERROR_NO_VIDEO_TRAFFIC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -128,7 +129,7 @@ static void ReceiveThreadProc(void* context) {
|
|||||||
// We've received data, so we can stop sending our ping packets
|
// We've received data, so we can stop sending our ping packets
|
||||||
// as quickly, since we're now just keeping the NAT session open.
|
// as quickly, since we're now just keeping the NAT session open.
|
||||||
receivedDataFromPeer = 1;
|
receivedDataFromPeer = 1;
|
||||||
Limelog("Received first video packet\n");
|
Limelog("Received first video packet after %d ms\n", waitingForVideoMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert fields to host byte-order
|
// Convert fields to host byte-order
|
||||||
|
|||||||
Reference in New Issue
Block a user