Update moonlight-common-c

This commit is contained in:
Cameron Gutman
2026-09-01 00:38:37 -05:00
parent 9221a0ca3a
commit 0dc4c4fe67
6 changed files with 22 additions and 11 deletions
@@ -113,6 +113,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
private long lastTimestampUs;
private int lastFrameNumber;
private long baseTimestampUs;
private int refreshRate;
private PreferenceConfiguration prefs;
@@ -1396,7 +1397,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
@Override
public int submitDecodeUnit(byte[] decodeUnitData, int decodeUnitLength, int decodeUnitType,
int frameNumber, int frameType, char frameHostProcessingLatency,
long receiveTimeMs, long enqueueTimeMs) {
long receiveTimeUs, long enqueueTimeUs) {
if (stopping) {
// Don't bother if we're stopping
return MoonBridge.DR_OK;
@@ -1695,7 +1696,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
// Count time from first packet received to enqueue time as receive time
// We will count DU queue time as part of decoding, because it is directly
// caused by a slow decoder.
activeWindowVideoStats.totalTimeMs += enqueueTimeMs - receiveTimeMs;
activeWindowVideoStats.totalTimeMs += (enqueueTimeUs - receiveTimeUs) / 1000;
}
if (!fetchNextInputBuffer()) {
@@ -1721,7 +1722,12 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
}
}
long timestampUs = enqueueTimeMs * 1000;
// The frame timestamps use an undefined epoch, so normalize them to uptime microseconds.
if (baseTimestampUs == 0) {
baseTimestampUs = (SystemClock.uptimeMillis() * 1000) - enqueueTimeUs;
}
long timestampUs = baseTimestampUs + enqueueTimeUs;
if (timestampUs <= lastTimestampUs) {
// We can't submit multiple buffers with the same timestamp
// so bump it up by one before queuing
@@ -11,7 +11,7 @@ public abstract class VideoDecoderRenderer {
// for an IDR frame which contains several parameter sets and the I-frame data.
public abstract int submitDecodeUnit(byte[] decodeUnitData, int decodeUnitLength, int decodeUnitType,
int frameNumber, int frameType, char frameHostProcessingLatency,
long receiveTimeMs, long enqueueTimeMs);
long receiveTimeUs, long enqueueTimeUs);
public abstract void cleanup();
@@ -102,6 +102,7 @@ public class MoonBridge {
public static final byte LI_CTYPE_XBOX = 0x01;
public static final byte LI_CTYPE_PS = 0x02;
public static final byte LI_CTYPE_NINTENDO = 0x03;
public static final byte LI_CTYPE_STEAM = 0x04;
public static final short LI_CCAP_ANALOG_TRIGGERS = 0x01;
public static final short LI_CCAP_RUMBLE = 0x02;
@@ -111,6 +112,7 @@ public class MoonBridge {
public static final short LI_CCAP_GYRO = 0x20;
public static final short LI_CCAP_BATTERY_STATE = 0x40;
public static final short LI_CCAP_RGB_LED = 0x80;
public static final short LI_CCAP_DUAL_TOUCHPAD = 0x100;
public static final byte LI_MOTION_TYPE_ACCEL = 0x01;
public static final byte LI_MOTION_TYPE_GYRO = 0x02;
@@ -217,10 +219,10 @@ public class MoonBridge {
public static int bridgeDrSubmitDecodeUnit(byte[] decodeUnitData, int decodeUnitLength, int decodeUnitType,
int frameNumber, int frameType, char frameHostProcessingLatency,
long receiveTimeMs, long enqueueTimeMs) {
long receiveTimeUs, long enqueueTimeUs) {
if (videoRenderer != null) {
return videoRenderer.submitDecodeUnit(decodeUnitData, decodeUnitLength,
decodeUnitType, frameNumber, frameType, frameHostProcessingLatency, receiveTimeMs, enqueueTimeMs);
decodeUnitType, frameNumber, frameType, frameHostProcessingLatency, receiveTimeUs, enqueueTimeUs);
}
else {
return DR_OK;
+5 -2
View File
@@ -28,7 +28,9 @@ LOCAL_SRC_FILES := moonlight-common-c/src/AudioStream.c \
moonlight-common-c/src/SimpleStun.c \
moonlight-common-c/src/VideoDepacketizer.c \
moonlight-common-c/src/VideoStream.c \
moonlight-common-c/reedsolomon/rs.c \
moonlight-common-c/nanors/deps/obl/oblas_common.c \
moonlight-common-c/nanors/deps/obl/oblas_lite.c \
moonlight-common-c/nanors/rs.c \
moonlight-common-c/enet/callbacks.c \
moonlight-common-c/enet/compress.c \
moonlight-common-c/enet/host.c \
@@ -44,7 +46,8 @@ LOCAL_SRC_FILES := moonlight-common-c/src/AudioStream.c \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/moonlight-common-c/enet/include \
$(LOCAL_PATH)/moonlight-common-c/reedsolomon \
$(LOCAL_PATH)/moonlight-common-c/nanors/deps/obl \
$(LOCAL_PATH)/moonlight-common-c/nanors \
$(LOCAL_PATH)/moonlight-common-c/src \
LOCAL_CFLAGS := -DHAS_SOCKLEN_T=1 -DLC_ANDROID -DHAVE_CLOCK_GETTIME=1
+2 -2
View File
@@ -168,7 +168,7 @@ int BridgeDrSubmitDecodeUnit(PDECODE_UNIT decodeUnit) {
ret = (*env)->CallStaticIntMethod(env, GlobalBridgeClass, BridgeDrSubmitDecodeUnitMethod,
DecodedFrameBuffer, currentEntry->length, currentEntry->bufferType,
decodeUnit->frameNumber, decodeUnit->frameType, (jchar)decodeUnit->frameHostProcessingLatency,
(jlong)decodeUnit->receiveTimeMs, (jlong)decodeUnit->enqueueTimeMs);
(jlong)decodeUnit->receiveTimeUs, (jlong)decodeUnit->enqueueTimeUs);
if ((*env)->ExceptionCheck(env)) {
// We will crash here
(*JVM)->DetachCurrentThread(JVM);
@@ -189,7 +189,7 @@ int BridgeDrSubmitDecodeUnit(PDECODE_UNIT decodeUnit) {
ret = (*env)->CallStaticIntMethod(env, GlobalBridgeClass, BridgeDrSubmitDecodeUnitMethod,
DecodedFrameBuffer, offset, BUFFER_TYPE_PICDATA,
decodeUnit->frameNumber, decodeUnit->frameType, (jchar)decodeUnit->frameHostProcessingLatency,
(jlong)decodeUnit->receiveTimeMs, (jlong)decodeUnit->enqueueTimeMs);
(jlong)decodeUnit->receiveTimeUs, (jlong)decodeUnit->enqueueTimeUs);
if ((*env)->ExceptionCheck(env)) {
// We will crash here
(*JVM)->DetachCurrentThread(JVM);