mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 19:42:45 +00:00
Allow video decoder capabilities to be set at runtime
This commit is contained in:
parent
203fcd82e7
commit
ae852eb911
@ -19,4 +19,6 @@ public class ConnectionContext {
|
||||
|
||||
public int negotiatedWidth, negotiatedHeight;
|
||||
public int negotiatedFps;
|
||||
|
||||
public int videoCapabilities;
|
||||
}
|
||||
|
@ -230,13 +230,15 @@ public class NvConnection {
|
||||
context.negotiatedWidth, context.negotiatedHeight,
|
||||
context.negotiatedFps, context.streamConfig.getBitrate(),
|
||||
context.streamConfig.getRemote(), context.streamConfig.getAudioConfiguration(),
|
||||
context.streamConfig.getHevcSupported(), context.riKey.getEncoded(), ib.array());
|
||||
context.streamConfig.getHevcSupported(), context.riKey.getEncoded(), ib.array(),
|
||||
context.videoCapabilities);
|
||||
}
|
||||
|
||||
public void start(AudioRenderer audioRenderer, VideoDecoderRenderer videoDecoderRenderer, NvConnectionListener connectionListener)
|
||||
{
|
||||
MoonBridge.setupBridge(videoDecoderRenderer, audioRenderer, connectionListener);
|
||||
context.connListener = connectionListener;
|
||||
context.videoCapabilities = videoDecoderRenderer.getCapabilities();
|
||||
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -6,4 +6,6 @@ public abstract class VideoDecoderRenderer {
|
||||
public abstract int submitDecodeUnit(byte[] frameData);
|
||||
|
||||
public abstract void cleanup();
|
||||
|
||||
public abstract int getCapabilities();
|
||||
}
|
||||
|
@ -127,7 +127,8 @@ public class MoonBridge {
|
||||
int width, int height, int fps,
|
||||
int bitrate, boolean streamingRemotely,
|
||||
int audioConfiguration, boolean supportsHevc,
|
||||
byte[] riAesKey, byte[] riAesIv);
|
||||
byte[] riAesKey, byte[] riAesIv,
|
||||
int videoCapabilities);
|
||||
|
||||
public static native void stopConnection();
|
||||
|
||||
|
@ -269,7 +269,6 @@ static DECODER_RENDERER_CALLBACKS BridgeVideoRendererCallbacks = {
|
||||
.setup = BridgeDrSetup,
|
||||
.cleanup = BridgeDrCleanup,
|
||||
.submitDecodeUnit = BridgeDrSubmitDecodeUnit,
|
||||
.capabilities = CAPABILITY_SLICES_PER_FRAME(4), // HACK: This was common-java's default
|
||||
};
|
||||
|
||||
static AUDIO_RENDERER_CALLBACKS BridgeAudioRendererCallbacks = {
|
||||
@ -294,7 +293,8 @@ Java_com_limelight_nvstream_jni_MoonBridge_startConnection(JNIEnv *env, jobject
|
||||
jint width, jint height, jint fps,
|
||||
jint bitrate, jboolean streamingRemotely,
|
||||
jint audioConfiguration, jboolean supportsHevc,
|
||||
jbyteArray riAesKey, jbyteArray riAesIv) {
|
||||
jbyteArray riAesKey, jbyteArray riAesIv,
|
||||
jint videoCapabilities) {
|
||||
SERVER_INFORMATION serverInfo = {
|
||||
.address = (*env)->GetStringUTFChars(env, address, 0),
|
||||
.serverInfoAppVersion = (*env)->GetStringUTFChars(env, appVersion, 0),
|
||||
@ -318,6 +318,8 @@ Java_com_limelight_nvstream_jni_MoonBridge_startConnection(JNIEnv *env, jobject
|
||||
memcpy(streamConfig.remoteInputAesIv, riAesIvBuf, sizeof(streamConfig.remoteInputAesIv));
|
||||
(*env)->ReleaseByteArrayElements(env, riAesIv, riAesIvBuf, JNI_ABORT);
|
||||
|
||||
BridgeVideoRendererCallbacks.capabilities = videoCapabilities;
|
||||
|
||||
int ret = LiStartConnection(&serverInfo, &streamConfig, &BridgeConnListenerCallbacks, &BridgeVideoRendererCallbacks, &BridgeAudioRendererCallbacks, NULL, 0);
|
||||
|
||||
(*env)->ReleaseStringUTFChars(env, address, serverInfo.address);
|
||||
|
Loading…
x
Reference in New Issue
Block a user