mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 12:03:02 +00:00
Improve streaming QoS
This commit is contained in:
parent
021cfd1737
commit
bd2a1b8886
@ -9,6 +9,7 @@ public class StreamConfiguration {
|
|||||||
private boolean enableAdaptiveResolution;
|
private boolean enableAdaptiveResolution;
|
||||||
private boolean playLocalAudio;
|
private boolean playLocalAudio;
|
||||||
private int maxPacketSize;
|
private int maxPacketSize;
|
||||||
|
private boolean remote;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private StreamConfiguration config = new StreamConfiguration();
|
private StreamConfiguration config = new StreamConfiguration();
|
||||||
@ -18,6 +19,11 @@ public class StreamConfiguration {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamConfiguration.Builder setRemote(boolean remote) {
|
||||||
|
config.remote = remote;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public StreamConfiguration.Builder setResolution(int width, int height) {
|
public StreamConfiguration.Builder setResolution(int width, int height) {
|
||||||
config.width = width;
|
config.width = width;
|
||||||
config.height = height;
|
config.height = height;
|
||||||
@ -106,4 +112,8 @@ public class StreamConfiguration {
|
|||||||
public boolean getPlayLocalAudio() {
|
public boolean getPlayLocalAudio() {
|
||||||
return playLocalAudio;
|
return playLocalAudio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getRemote() {
|
||||||
|
return remote;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,15 @@ public class SdpGenerator {
|
|||||||
addSessionAttributeInt(config, "x-nv-video[2].rateControlMode", 0x42514141);
|
addSessionAttributeInt(config, "x-nv-video[2].rateControlMode", 0x42514141);
|
||||||
addSessionAttributeInt(config, "x-nv-video[3].rateControlMode", 0x42514141);
|
addSessionAttributeInt(config, "x-nv-video[3].rateControlMode", 0x42514141);
|
||||||
|
|
||||||
|
if (sc.getRemote()) {
|
||||||
|
addSessionAttribute(config, "x-nv-video[0].averageBitrate", "4");
|
||||||
|
addSessionAttribute(config, "x-nv-video[0].peakBitrate", "4");
|
||||||
|
}
|
||||||
|
else if (sc.getBitrate() <= 13000) {
|
||||||
|
addSessionAttribute(config, "x-nv-video[0].averageBitrate", "9");
|
||||||
|
addSessionAttribute(config, "x-nv-video[0].peakBitrate", "9");
|
||||||
|
}
|
||||||
|
|
||||||
addSessionAttribute(config, "x-nv-video[0].timeoutLengthMs", "7000");
|
addSessionAttribute(config, "x-nv-video[0].timeoutLengthMs", "7000");
|
||||||
addSessionAttribute(config, "x-nv-video[0].framesWithInvalidRefThreshold", "0");
|
addSessionAttribute(config, "x-nv-video[0].framesWithInvalidRefThreshold", "0");
|
||||||
|
|
||||||
@ -109,14 +118,25 @@ public class SdpGenerator {
|
|||||||
addSessionAttribute(config, "x-nv-vqos[0].fec.enable", "0");
|
addSessionAttribute(config, "x-nv-vqos[0].fec.enable", "0");
|
||||||
|
|
||||||
addSessionAttribute(config, "x-nv-vqos[0].videoQualityScoreUpdateTime", "5000");
|
addSessionAttribute(config, "x-nv-vqos[0].videoQualityScoreUpdateTime", "5000");
|
||||||
addSessionAttribute(config, "x-nv-vqos[0].qosTrafficType", "5");
|
|
||||||
|
if (sc.getRemote()) {
|
||||||
|
addSessionAttribute(config, "x-nv-vqos[0].qosTrafficType", "0");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addSessionAttribute(config, "x-nv-vqos[0].qosTrafficType", "5");
|
||||||
|
}
|
||||||
|
|
||||||
addSessionAttribute(config, "x-nv-vqos[0].videoQosMaxConsecutiveDrops", "0");
|
addSessionAttribute(config, "x-nv-vqos[0].videoQosMaxConsecutiveDrops", "0");
|
||||||
addSessionAttribute(config, "x-nv-vqos[1].videoQosMaxConsecutiveDrops", "0");
|
addSessionAttribute(config, "x-nv-vqos[1].videoQosMaxConsecutiveDrops", "0");
|
||||||
addSessionAttribute(config, "x-nv-vqos[2].videoQosMaxConsecutiveDrops", "0");
|
addSessionAttribute(config, "x-nv-vqos[2].videoQosMaxConsecutiveDrops", "0");
|
||||||
addSessionAttribute(config, "x-nv-vqos[3].videoQosMaxConsecutiveDrops", "0");
|
addSessionAttribute(config, "x-nv-vqos[3].videoQosMaxConsecutiveDrops", "0");
|
||||||
|
|
||||||
addSessionAttribute(config, "x-nv-aqos.qosTrafficType", "8");
|
if (sc.getRemote()) {
|
||||||
|
addSessionAttribute(config, "x-nv-aqos.qosTrafficType", "0");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addSessionAttribute(config, "x-nv-aqos.qosTrafficType", "4");
|
||||||
|
}
|
||||||
|
|
||||||
config.append("t=0 0").append("\r\n");
|
config.append("t=0 0").append("\r\n");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user