Add friendly messages for certain error cases

This commit is contained in:
Cameron Gutman 2021-07-25 15:25:13 -05:00
parent 5215271b60
commit e2c2575efb

View File

@ -27,7 +27,27 @@ pthread_t main_thread_id = 0;
bool connection_debug;
ConnListenerRumble rumble_handler = NULL;
static void connection_terminated() {
static void connection_terminated(int errorCode) {
switch (errorCode) {
case ML_ERROR_GRACEFUL_TERMINATION:
break;
case ML_ERROR_NO_VIDEO_TRAFFIC:
printf("No video received from host. Check the host PC's firewall and port forwarding rules.\n");
break;
case ML_ERROR_NO_VIDEO_FRAME:
printf("Your network connection isn't performing well. Reduce your video bitrate setting or try a faster connection.\n");
break;
case ML_ERROR_UNEXPECTED_EARLY_TERMINATION:
printf("The connection was unexpectedly terminated by the host due to a video capture error. Make sure no DRM-protected content is playing on the host.\n");
break;
case ML_ERROR_PROTECTED_CONTENT:
printf("The connection was terminated by the host due to DRM-protected content. Close any DRM-protected content on the host and try again.\n");
break;
default:
printf("Connection terminated with error: %d\n", errorCode);
break;
}
if (main_thread_id != 0)
pthread_kill(main_thread_id, SIGTERM);
}