From 9b9020b5122d0adc9bed0a53c06a72e603b5ef60 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 26 Oct 2015 17:33:01 -0700 Subject: [PATCH] Adjust bitrate lower bounds to match the default resolution bitrate to fix image quality issues at the very beginning of the stream --- .../limelight/nvstream/rtsp/SdpGenerator.java | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/moonlight-common/src/com/limelight/nvstream/rtsp/SdpGenerator.java b/moonlight-common/src/com/limelight/nvstream/rtsp/SdpGenerator.java index 5450d1c2..3474cfd0 100644 --- a/moonlight-common/src/com/limelight/nvstream/rtsp/SdpGenerator.java +++ b/moonlight-common/src/com/limelight/nvstream/rtsp/SdpGenerator.java @@ -98,7 +98,31 @@ public class SdpGenerator { addSessionAttribute(config, "x-nv-video[0].framesWithInvalidRefThreshold", "0"); // Lock the bitrate if we're not scaling resolution so the picture doesn't get too bad - if (context.streamConfig.getHeight() >= 1080 && context.streamConfig.getRefreshRate() >= 60) { + if (context.streamConfig.getHeight() >= 2160 && context.streamConfig.getRefreshRate() >= 60) { + if (context.streamConfig.getBitrate() < 80000) { + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+context.streamConfig.getBitrate()); + } + else { + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "80000"); + } + } + else if (context.streamConfig.getHeight() >= 2160) { + if (context.streamConfig.getBitrate() < 40000) { + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+context.streamConfig.getBitrate()); + } + else { + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "40000"); + } + } + else if (context.streamConfig.getHeight() >= 1080 && context.streamConfig.getRefreshRate() >= 60) { + if (context.streamConfig.getBitrate() < 20000) { + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+context.streamConfig.getBitrate()); + } + else { + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "20000"); + } + } + else if (context.streamConfig.getHeight() >= 1080 || context.streamConfig.getRefreshRate() >= 60) { if (context.streamConfig.getBitrate() < 10000) { addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+context.streamConfig.getBitrate()); } @@ -106,20 +130,12 @@ public class SdpGenerator { addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "10000"); } } - else if (context.streamConfig.getHeight() >= 1080 || context.streamConfig.getRefreshRate() >= 60) { - if (context.streamConfig.getBitrate() < 7000) { - addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+context.streamConfig.getBitrate()); - } - else { - addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "7000"); - } - } else { - if (context.streamConfig.getBitrate() < 3000) { + if (context.streamConfig.getBitrate() < 5000) { addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+context.streamConfig.getBitrate()); } else { - addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "3000"); + addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "5000"); } }