mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 11:33:06 +00:00
Add support for adaptive resolution changes
This commit is contained in:
parent
96ad2bcdef
commit
bd9c6834b7
@ -6,6 +6,7 @@ public class StreamConfiguration {
|
||||
private int refreshRate;
|
||||
private int bitrate;
|
||||
private boolean sops;
|
||||
private boolean enableAdaptiveResolution;
|
||||
|
||||
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate) {
|
||||
this.app = app;
|
||||
@ -16,13 +17,15 @@ public class StreamConfiguration {
|
||||
this.sops = true;
|
||||
}
|
||||
|
||||
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, boolean sops) {
|
||||
public StreamConfiguration(String app, int width, int height, int refreshRate, int bitrate, boolean sops,
|
||||
boolean enableAdaptiveResolution) {
|
||||
this.app = app;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.refreshRate = refreshRate;
|
||||
this.bitrate = bitrate;
|
||||
this.sops = sops;
|
||||
this.enableAdaptiveResolution = enableAdaptiveResolution;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
@ -52,4 +55,8 @@ public class StreamConfiguration {
|
||||
public boolean getSops() {
|
||||
return sops;
|
||||
}
|
||||
|
||||
public boolean getAdaptiveResolutionEnabled() {
|
||||
return enableAdaptiveResolution;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,9 @@ public interface VideoDecoderRenderer {
|
||||
public static final int FLAG_FORCE_SOFTWARE_DECODING = 0x4;
|
||||
public static final int FLAG_FILL_SCREEN = 0x8;
|
||||
|
||||
// Allows the resolution to dynamically change mid-stream
|
||||
public static final int CAPABILITY_ADAPTIVE_RESOLUTION = 0x1;
|
||||
|
||||
public int getCapabilities();
|
||||
|
||||
public int getAverageEndToEndLatency();
|
||||
|
@ -64,9 +64,16 @@ public class SdpGenerator {
|
||||
addSessionAttribute(config, "x-nv-video[0].timeoutLengthMs", "7000");
|
||||
addSessionAttribute(config, "x-nv-video[0].framesWithInvalidRefThreshold", "0");
|
||||
|
||||
// It should be 16183 but adding 100 but causes resolution to scale in the beginning
|
||||
// The bit 0x80 enables video scaling on packet loss which we can't support (for now)
|
||||
addSessionAttribute(config, "x-nv-vqos[0].bw.flags", "16083");
|
||||
|
||||
if (sc.getAdaptiveResolutionEnabled()) {
|
||||
addSessionAttribute(config, "x-nv-vqos[0].bw.flags", "16183");
|
||||
}
|
||||
else {
|
||||
addSessionAttribute(config, "x-nv-vqos[0].bw.flags", "16083");
|
||||
|
||||
// Lock the bitrate if we're not scaling resolution so the picture doesn't get too bad
|
||||
addSessionAttribute(config, "x-nv-vqos[0].bw.minimumBitrate", ""+sc.getBitrate());
|
||||
}
|
||||
|
||||
addSessionAttribute(config, "x-nv-vqos[0].bw.maximumBitrate", ""+sc.getBitrate());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user