Add support for selecting maximum stream bitrate

This commit is contained in:
Cameron Gutman 2014-05-07 02:11:46 -04:00
parent 09e7ff0582
commit a4098919b9
2 changed files with 24 additions and 10 deletions

View File

@ -3,11 +3,13 @@ package com.limelight.nvstream;
public class StreamConfiguration { public class StreamConfiguration {
private int width, height; private int width, height;
private int refreshRate; private int refreshRate;
private int bitrate;
public StreamConfiguration(int width, int height, int refreshRate) { public StreamConfiguration(int width, int height, int refreshRate, int bitrate) {
this.width = width; this.width = width;
this.height = height; this.height = height;
this.refreshRate = refreshRate; this.refreshRate = refreshRate;
this.bitrate = bitrate;
} }
public int getWidth() { public int getWidth() {
@ -21,4 +23,8 @@ public class StreamConfiguration {
public int getRefreshRate() { public int getRefreshRate() {
return refreshRate; return refreshRate;
} }
public int getBitrate() {
return bitrate;
}
} }

View File

@ -157,20 +157,28 @@ public class SdpGenerator {
addSessionAttribute(config, "x-nv-vqos[0].ts.enable", "0"); addSessionAttribute(config, "x-nv-vqos[0].ts.enable", "0");
addSessionAttribute(config, "x-nv-vqos[0].ts.averageBitrate", "8"); addSessionAttribute(config, "x-nv-vqos[0].ts.averageBitrate", "8");
addSessionAttribute(config, "x-nv-vqos[0].ts.maximumBitrate", "10"); addSessionAttribute(config, "x-nv-vqos[0].ts.maximumBitrate", "10");
addSessionAttribute(config, "x-nv-vqos[0].bw.flags", "823"); addSessionAttribute(config, "x-nv-vqos[0].bw.flags", "819"); // Bit 2 being set causes picture problems (should be 823)
// Effective bitrate ceiling // Effective bitrate ceiling
if (sc.getHeight() >= 1080) { if (sc.getHeight() >= 1080) {
addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", "30000"); if (sc.getRefreshRate() >= 60) {
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "25000"); addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", ""+sc.getBitrate());
} addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "20000");
else if (sc.getRefreshRate() >= 60) { }
addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", "13000"); else {
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "13000"); addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", ""+sc.getBitrate());
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "10000");
}
} }
else { else {
addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", "10000"); if (sc.getRefreshRate() >= 60) {
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "2000"); addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", ""+sc.getBitrate());
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "8000");
}
else {
addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", ""+sc.getBitrate());
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", "4000");
}
} }
addSessionAttribute(config, "x-nv-vqos[0].bw.statsTime", "50"); addSessionAttribute(config, "x-nv-vqos[0].bw.statsTime", "50");