From f6ae7fc2b4d2c0c5d2a8cb8ebc55f4157156c9f1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 30 Nov 2017 23:38:49 -0800 Subject: [PATCH] Improve decoder compatibility by using num_ref_frames=1 when RFI is disabled. Fixes decoder hangs on Amlogic SoCs. --- src/SdpGenerator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/SdpGenerator.c b/src/SdpGenerator.c index 4cbc4f8..98f7a8f 100644 --- a/src/SdpGenerator.c +++ b/src/SdpGenerator.c @@ -323,6 +323,18 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) { sprintf(payloadStr, "%d", slicesPerFrame); err |= addAttributeString(&optionHead, "x-nv-video[0].videoEncoderSlicesPerFrame", payloadStr); } + + if (AppVersionQuad[0] >= 7) { + if (isReferenceFrameInvalidationEnabled()) { + err |= addAttributeString(&optionHead, "x-nv-video[0].maxNumReferenceFrames", "0"); + } + else { + // Restrict the video stream to 1 reference frame if we're not using + // reference frame invalidation. This helps to improve compatibility with + // some decoders that don't like the default of having 16 reference frames. + err |= addAttributeString(&optionHead, "x-nv-video[0].maxNumReferenceFrames", "1"); + } + } if (StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_51_SURROUND) { audioChannelCount = CHANNEL_COUNT_51_SURROUND;