mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-14 03:36:12 +00:00
Disable RFI when streaming from a server that doesn't support it
This commit is contained in:
@@ -24,6 +24,7 @@ OPUS_MULTISTREAM_CONFIGURATION HighQualityOpusConfig;
|
||||
int OriginalVideoBitrate;
|
||||
int AudioPacketDuration;
|
||||
bool AudioEncryptionEnabled;
|
||||
bool ReferenceFrameInvalidationSupported;
|
||||
uint16_t RtspPortNumber;
|
||||
uint16_t ControlPortNumber;
|
||||
uint16_t AudioPortNumber;
|
||||
|
||||
@@ -31,6 +31,7 @@ extern OPUS_MULTISTREAM_CONFIGURATION HighQualityOpusConfig;
|
||||
extern int OriginalVideoBitrate;
|
||||
extern int AudioPacketDuration;
|
||||
extern bool AudioEncryptionEnabled;
|
||||
extern bool ReferenceFrameInvalidationSupported;
|
||||
|
||||
extern uint16_t RtspPortNumber;
|
||||
extern uint16_t ControlPortNumber;
|
||||
|
||||
@@ -121,6 +121,12 @@ void* extendBuffer(void* ptr, size_t newSize) {
|
||||
|
||||
bool isReferenceFrameInvalidationEnabled(void) {
|
||||
LC_ASSERT(NegotiatedVideoFormat != 0);
|
||||
|
||||
// Even if the client wants it, we can't enable it without server support.
|
||||
if (!ReferenceFrameInvalidationSupported) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H264) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
||||
((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H265) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC));
|
||||
}
|
||||
|
||||
@@ -806,6 +806,12 @@ int performRtspHandshake(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// Look for the SDP attribute that indicates we're dealing with a server that supports RFI
|
||||
ReferenceFrameInvalidationSupported = strstr(response.payload, "x-nv-video[0].refPicInvalidation") != NULL;
|
||||
if (!ReferenceFrameInvalidationSupported) {
|
||||
Limelog("Reference frame invalidation is not supported by this host\n");
|
||||
}
|
||||
|
||||
// Parse the Opus surround parameters out of the RTSP DESCRIBE response.
|
||||
ret = parseOpusConfigurations(&response);
|
||||
if (ret != 0) {
|
||||
|
||||
Reference in New Issue
Block a user