Implement support for non-default ports with Sunshine

Fixes #1115
This commit is contained in:
Cameron Gutman
2022-11-06 17:36:46 -06:00
parent a896f9a28f
commit 7af290b6e1
14 changed files with 277 additions and 77 deletions

View File

@@ -22,6 +22,7 @@ import com.limelight.nvstream.NvConnectionListener;
import com.limelight.nvstream.StreamConfiguration;
import com.limelight.nvstream.http.ComputerDetails;
import com.limelight.nvstream.http.NvApp;
import com.limelight.nvstream.http.NvHTTP;
import com.limelight.nvstream.input.KeyboardPacket;
import com.limelight.nvstream.input.MouseButtonPacket;
import com.limelight.nvstream.jni.MoonBridge;
@@ -166,6 +167,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
};
public static final String EXTRA_HOST = "Host";
public static final String EXTRA_PORT = "Port";
public static final String EXTRA_APP_NAME = "AppName";
public static final String EXTRA_APP_ID = "AppId";
public static final String EXTRA_UNIQUEID = "UniqueId";
@@ -311,6 +313,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
pcName = Game.this.getIntent().getStringExtra(EXTRA_PC_NAME);
String host = Game.this.getIntent().getStringExtra(EXTRA_HOST);
int port = Game.this.getIntent().getIntExtra(EXTRA_PORT, NvHTTP.DEFAULT_HTTP_PORT);
int appId = Game.this.getIntent().getIntExtra(EXTRA_APP_ID, StreamConfiguration.INVALID_APP_ID);
String uniqueId = Game.this.getIntent().getStringExtra(EXTRA_UNIQUEID);
String uuid = Game.this.getIntent().getStringExtra(EXTRA_PC_UUID);
@@ -472,7 +475,11 @@ public class Game extends Activity implements SurfaceHolder.Callback,
.build();
// Initialize the connection
conn = new NvConnection(getApplicationContext(), host, uniqueId, config, PlatformBinding.getCryptoProvider(this), serverCert, needsInputBatching);
conn = new NvConnection(getApplicationContext(),
new ComputerDetails.AddressTuple(host, port),
uniqueId, config,
PlatformBinding.getCryptoProvider(this), serverCert,
needsInputBatching);
controllerHandler = new ControllerHandler(this, conn, this, prefConfig);
keyboardTranslator = new KeyboardTranslator();