mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 14:21:30 +00:00
Add APP_VERSION_AT_LEAST() macro for cleaner GFE version checks
This commit is contained in:
+1
-3
@@ -208,9 +208,7 @@ int initializeControlStream(void) {
|
|||||||
intervalStartTimeMs = 0;
|
intervalStartTimeMs = 0;
|
||||||
lastIntervalLossPercentage = 0;
|
lastIntervalLossPercentage = 0;
|
||||||
lastConnectionStatusUpdate = CONN_STATUS_OKAY;
|
lastConnectionStatusUpdate = CONN_STATUS_OKAY;
|
||||||
usePeriodicPing = (AppVersionQuad[0] > 7) ||
|
usePeriodicPing = APP_VERSION_AT_LEAST(7, 1, 415);
|
||||||
(AppVersionQuad[0] == 7 && AppVersionQuad[1] > 1) ||
|
|
||||||
(AppVersionQuad[0] == 7 && AppVersionQuad[1] == 1 && AppVersionQuad[2] >= 415);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ extern int AudioPacketDuration;
|
|||||||
#define isBefore24(x, y) (U24((x) - (y)) > (UINT24_MAX/2))
|
#define isBefore24(x, y) (U24((x) - (y)) > (UINT24_MAX/2))
|
||||||
#define isBefore32(x, y) (U32((x) - (y)) > (UINT32_MAX/2))
|
#define isBefore32(x, y) (U32((x) - (y)) > (UINT32_MAX/2))
|
||||||
|
|
||||||
|
#define APP_VERSION_AT_LEAST(a, b, c, d) \
|
||||||
|
((AppVersionQuad[0] > (a)) || \
|
||||||
|
(AppVersionQuad[0] == (a) && AppVersionQuad[1] > (b)) || \
|
||||||
|
(AppVersionQuad[0] == (a) && AppVersionQuad[1] == (b) && AppVersionQuad[2] >= (c)))
|
||||||
|
|
||||||
#define UDP_RECV_POLL_TIMEOUT_MS 100
|
#define UDP_RECV_POLL_TIMEOUT_MS 100
|
||||||
|
|
||||||
// At this value or above, we will request high quality audio unless CAPABILITY_SLOW_OPUS_DECODER
|
// At this value or above, we will request high quality audio unless CAPABILITY_SLOW_OPUS_DECODER
|
||||||
|
|||||||
@@ -638,9 +638,7 @@ static void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length,
|
|||||||
|
|
||||||
// If this is the first packet, skip the frame header (if one exists)
|
// If this is the first packet, skip the frame header (if one exists)
|
||||||
if (firstPacket) {
|
if (firstPacket) {
|
||||||
if ((AppVersionQuad[0] > 7) ||
|
if (APP_VERSION_AT_LEAST(7, 1, 415)) {
|
||||||
(AppVersionQuad[0] == 7 && AppVersionQuad[1] > 1) ||
|
|
||||||
(AppVersionQuad[0] == 7 && AppVersionQuad[1] == 1 && AppVersionQuad[2] >= 415)) {
|
|
||||||
// >= 7.1.415
|
// >= 7.1.415
|
||||||
// The first IDR frame now has smaller headers than the rest. We seem to be able to tell
|
// The first IDR frame now has smaller headers than the rest. We seem to be able to tell
|
||||||
// them apart by looking at the first byte. It will be 0x81 for the long header and 0x01
|
// them apart by looking at the first byte. It will be 0x81 for the long header and 0x01
|
||||||
@@ -657,17 +655,17 @@ static void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length,
|
|||||||
currentPos.length -= 24;
|
currentPos.length -= 24;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (AppVersionQuad[0] == 7 && AppVersionQuad[1] == 1 && AppVersionQuad[2] >= 350) {
|
else if (APP_VERSION_AT_LEAST(7, 1, 350)) {
|
||||||
// [7.1.350, 7.1.415) should use the 8 byte header again
|
// [7.1.350, 7.1.415) should use the 8 byte header again
|
||||||
currentPos.offset += 8;
|
currentPos.offset += 8;
|
||||||
currentPos.length -= 8;
|
currentPos.length -= 8;
|
||||||
}
|
}
|
||||||
else if (AppVersionQuad[0] == 7 && AppVersionQuad[1] == 1 && AppVersionQuad[2] >= 320) {
|
else if (APP_VERSION_AT_LEAST(7, 1, 320)) {
|
||||||
// [7.1.320, 7.1.350) should use the 12 byte frame header
|
// [7.1.320, 7.1.350) should use the 12 byte frame header
|
||||||
currentPos.offset += 12;
|
currentPos.offset += 12;
|
||||||
currentPos.length -= 12;
|
currentPos.length -= 12;
|
||||||
}
|
}
|
||||||
else if (AppVersionQuad[0] >= 5) {
|
else if (APP_VERSION_AT_LEAST(5, 0, 0)) {
|
||||||
// [5.x, 7.1.320) should use the 8 byte header
|
// [5.x, 7.1.320) should use the 8 byte header
|
||||||
currentPos.offset += 8;
|
currentPos.offset += 8;
|
||||||
currentPos.length -= 8;
|
currentPos.length -= 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user