From 6dca9c6754b0e3697ef2d4b2be4affc74a1cb6bf Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 9 Apr 2021 11:53:03 -0500 Subject: [PATCH] Add special termination error code for protected content --- src/ControlStream.c | 6 +++++- src/Limelight.h | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ControlStream.c b/src/ControlStream.c index e6c06d0..c5f8324 100644 --- a/src/ControlStream.c +++ b/src/ControlStream.c @@ -817,7 +817,7 @@ static void controlReceiveThreadFunc(void* context) { Limelog("Server notified termination reason: 0x%08x\n", terminationErrorCode); - // Handle NVST_DISCONN_SERVER_TERMINATED_CLOSED specially + // NVST_DISCONN_SERVER_TERMINATED_CLOSED is the expected graceful termination error if (terminationErrorCode == 0x80030023) { if (lastSeenFrame != 0) { // Pass error code 0 to notify the client that this was not an error @@ -829,6 +829,10 @@ static void controlReceiveThreadFunc(void* context) { terminationErrorCode = ML_ERROR_UNEXPECTED_EARLY_TERMINATION; } } + // NVST_DISCONN_SERVER_VFP_PROTECTED_CONTENT means it failed due to protected content on screen + else if (terminationErrorCode == 0x800e9302) { + terminationErrorCode = ML_ERROR_PROTECTED_CONTENT; + } } else { uint16_t terminationReason; diff --git a/src/Limelight.h b/src/Limelight.h index c53599f..958a255 100644 --- a/src/Limelight.h +++ b/src/Limelight.h @@ -377,10 +377,14 @@ typedef void(*ConnListenerConnectionTerminated)(int errorCode); // This error is passed to ConnListenerConnectionTerminated() if the stream ends // very soon after starting due to a graceful termination from the host. Usually -// this seems to happen if DRM protected content is on-screen, or another issue -// that prevents the encoder from being able to capture video successfully. +// this seems to happen if DRM protected content is on-screen (pre-GFE 3.22), or +// another issue that prevents the encoder from being able to capture video successfully. #define ML_ERROR_UNEXPECTED_EARLY_TERMINATION -102 +// This error is passed to ConnListenerConnectionTerminated() if the stream ends +// due to a protected content error from the host. This value is supported on GFE 3.22+. +#define ML_ERROR_PROTECTED_CONTENT -103 + // This callback is invoked to log debug message typedef void(*ConnListenerLogMessage)(const char* format, ...);