diff --git a/src/ControlStream.c b/src/ControlStream.c index 33c8540..e49c50e 100644 --- a/src/ControlStream.c +++ b/src/ControlStream.c @@ -208,9 +208,7 @@ int initializeControlStream(void) { intervalStartTimeMs = 0; lastIntervalLossPercentage = 0; lastConnectionStatusUpdate = CONN_STATUS_OKAY; - usePeriodicPing = (AppVersionQuad[0] > 7) || - (AppVersionQuad[0] == 7 && AppVersionQuad[1] > 1) || - (AppVersionQuad[0] == 7 && AppVersionQuad[1] == 1 && AppVersionQuad[2] >= 415); + usePeriodicPing = APP_VERSION_AT_LEAST(7, 1, 415); return 0; } diff --git a/src/Limelight-internal.h b/src/Limelight-internal.h index e76012f..dbd49f5 100644 --- a/src/Limelight-internal.h +++ b/src/Limelight-internal.h @@ -39,6 +39,11 @@ extern int AudioPacketDuration; #define isBefore24(x, y) (U24((x) - (y)) > (UINT24_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 // At this value or above, we will request high quality audio unless CAPABILITY_SLOW_OPUS_DECODER diff --git a/src/VideoDepacketizer.c b/src/VideoDepacketizer.c index 7546b2f..833c27b 100644 --- a/src/VideoDepacketizer.c +++ b/src/VideoDepacketizer.c @@ -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 (firstPacket) { - if ((AppVersionQuad[0] > 7) || - (AppVersionQuad[0] == 7 && AppVersionQuad[1] > 1) || - (AppVersionQuad[0] == 7 && AppVersionQuad[1] == 1 && AppVersionQuad[2] >= 415)) { + if (APP_VERSION_AT_LEAST(7, 1, 415)) { // >= 7.1.415 // 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 @@ -657,17 +655,17 @@ static void processRtpPayload(PNV_VIDEO_PACKET videoPacket, int length, 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 currentPos.offset += 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 currentPos.offset += 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 currentPos.offset += 8; currentPos.length -= 8;