diff --git a/src/ConnectionTester.c b/src/ConnectionTester.c index 2985c1d..78d554c 100644 --- a/src/ConnectionTester.c +++ b/src/ConnectionTester.c @@ -27,6 +27,20 @@ unsigned int LiGetPortFlagsFromStage(int stage) } } +unsigned int LiGetPortFlagsFromTerminationErrorCode(int errorCode) +{ + switch (errorCode) + { + case ML_ERROR_NO_VIDEO_TRAFFIC: + // Video is UDP 47998, but we'll also test UDP 48000 because + // we don't have an equivalent audio traffic error. + return ML_PORT_FLAG_UDP_47998 | ML_PORT_FLAG_UDP_48000; + + default: + return 0; + } +} + int LiGetProtocolFromPortFlagIndex(int portFlagIndex) { // The lower byte is reserved for TCP diff --git a/src/Limelight.h b/src/Limelight.h index 3c05fd5..992bd43 100644 --- a/src/Limelight.h +++ b/src/Limelight.h @@ -555,10 +555,13 @@ int LiGetPendingAudioDuration(void); #define ML_PORT_FLAG_UDP_48000 0x0400 #define ML_PORT_FLAG_UDP_48010 0x0800 -// Returns the port flags that correspond to ports involved in a failing connection stage. -// This may be used to specifically test the ports that could have caused the connection failure. -// If no ports are likely involved with a given stage failure, this function returns 0. +// Returns the port flags that correspond to ports involved in a failing connection stage, or +// connection termination error. +// +// These may be used to specifically test the ports that could have caused the connection failure. +// If no ports are likely involved with a given failure, this function returns 0. unsigned int LiGetPortFlagsFromStage(int stage); +unsigned int LiGetPortFlagsFromTerminationErrorCode(int errorCode); // Returns the IPPROTO_* value for the specified port index int LiGetProtocolFromPortFlagIndex(int portFlagIndex);