Disable RFI when streaming from a server that doesn't support it

This commit is contained in:
Cameron Gutman
2022-10-06 20:01:40 -05:00
parent 9091238861
commit e951302927
4 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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));
}

View File

@@ -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) {