mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-10-23 00:27:40 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eac6998e17 | ||
|
|
17afbffdb5 | ||
|
|
072a439c2d |
No files matched your search
Binary file not shown.
@@ -231,7 +231,8 @@ public class AndroidCpuDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
if (decodeUnit.getDataLength() <= DECODER_BUFFER_SIZE) {
|
if (decodeUnit.getDataLength() <= DECODER_BUFFER_SIZE) {
|
||||||
decoderBuffer.clear();
|
decoderBuffer.clear();
|
||||||
|
|
||||||
for (ByteBufferDescriptor bbd : decodeUnit.getBufferList()) {
|
for (ByteBufferDescriptor bbd = decodeUnit.getBufferHead();
|
||||||
|
bbd != null; bbd = bbd.nextDescriptor) {
|
||||||
decoderBuffer.put(bbd.data, bbd.offset, bbd.length);
|
decoderBuffer.put(bbd.data, bbd.offset, bbd.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +242,8 @@ public class AndroidCpuDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
data = new byte[decodeUnit.getDataLength()+AvcDecoder.getInputPaddingSize()];
|
data = new byte[decodeUnit.getDataLength()+AvcDecoder.getInputPaddingSize()];
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (ByteBufferDescriptor bbd : decodeUnit.getBufferList()) {
|
for (ByteBufferDescriptor bbd = decodeUnit.getBufferHead();
|
||||||
|
bbd != null; bbd = bbd.nextDescriptor) {
|
||||||
System.arraycopy(bbd.data, bbd.offset, data, offset, bbd.length);
|
System.arraycopy(bbd.data, bbd.offset, data, offset, bbd.length);
|
||||||
offset += bbd.length;
|
offset += bbd.length;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,13 +239,13 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
inputIndex = dequeueInputBuffer(false, false);
|
inputIndex = dequeueInputBuffer(false, false);
|
||||||
du = depacketizer.pollNextDecodeUnit();
|
du = depacketizer.pollNextDecodeUnit();
|
||||||
|
if (du != null) {
|
||||||
|
lastDuDequeueTime = System.currentTimeMillis();
|
||||||
|
notifyDuReceived(du);
|
||||||
|
}
|
||||||
|
|
||||||
// Stop if we can't get a DU or input buffer
|
// Stop if we can't get a DU or input buffer
|
||||||
if (du == null || inputIndex == -1) {
|
if (du == null || inputIndex == -1) {
|
||||||
if (du != null) {
|
|
||||||
lastDuDequeueTime = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,6 +283,7 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
du = depacketizer.pollNextDecodeUnit();
|
du = depacketizer.pollNextDecodeUnit();
|
||||||
if (du != null) {
|
if (du != null) {
|
||||||
lastDuDequeueTime = System.currentTimeMillis();
|
lastDuDequeueTime = System.currentTimeMillis();
|
||||||
|
notifyDuReceived(du);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,14 +422,7 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void submitDecodeUnit(DecodeUnit decodeUnit, ByteBuffer buf, int inputBufferIndex) {
|
private void submitDecodeUnit(DecodeUnit decodeUnit, ByteBuffer buf, int inputBufferIndex) {
|
||||||
long currentTime = System.currentTimeMillis();
|
long timestampUs = System.currentTimeMillis() * 1000;
|
||||||
long delta = currentTime-decodeUnit.getReceiveTimestamp();
|
|
||||||
if (delta >= 0 && delta < 1000) {
|
|
||||||
totalTimeMs += currentTime-decodeUnit.getReceiveTimestamp();
|
|
||||||
totalFrames++;
|
|
||||||
}
|
|
||||||
|
|
||||||
long timestampUs = currentTime * 1000;
|
|
||||||
if (timestampUs <= lastTimestampUs) {
|
if (timestampUs <= lastTimestampUs) {
|
||||||
// We can't submit multiple buffers with the same timestamp
|
// We can't submit multiple buffers with the same timestamp
|
||||||
// so bump it up by one before queuing
|
// so bump it up by one before queuing
|
||||||
@@ -452,7 +446,7 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
boolean needsSpsReplay = false;
|
boolean needsSpsReplay = false;
|
||||||
|
|
||||||
if ((decodeUnitFlags & DecodeUnit.DU_FLAG_CODEC_CONFIG) != 0) {
|
if ((decodeUnitFlags & DecodeUnit.DU_FLAG_CODEC_CONFIG) != 0) {
|
||||||
ByteBufferDescriptor header = decodeUnit.getBufferList().get(0);
|
ByteBufferDescriptor header = decodeUnit.getBufferHead();
|
||||||
if (header.data[header.offset+4] == 0x67) {
|
if (header.data[header.offset+4] == 0x67) {
|
||||||
numSpsIn++;
|
numSpsIn++;
|
||||||
|
|
||||||
@@ -537,8 +531,8 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy data from our buffer list into the input buffer
|
// Copy data from our buffer list into the input buffer
|
||||||
for (ByteBufferDescriptor desc : decodeUnit.getBufferList())
|
for (ByteBufferDescriptor desc = decodeUnit.getBufferHead();
|
||||||
{
|
desc != null; desc = desc.nextDescriptor) {
|
||||||
buf.put(desc.data, desc.offset, desc.length);
|
buf.put(desc.data, desc.offset, desc.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,10 +608,21 @@ public class MediaCodecDecoderRenderer extends EnhancedDecoderRenderer {
|
|||||||
return decoderName;
|
return decoderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyDuReceived(DecodeUnit du) {
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
long delta = currentTime-du.getReceiveTimestamp();
|
||||||
|
if (delta >= 0 && delta < 1000) {
|
||||||
|
totalTimeMs += currentTime-du.getReceiveTimestamp();
|
||||||
|
totalFrames++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void directSubmitDecodeUnit(DecodeUnit du) {
|
public void directSubmitDecodeUnit(DecodeUnit du) {
|
||||||
int inputIndex;
|
int inputIndex;
|
||||||
|
|
||||||
|
notifyDuReceived(du);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
try {
|
try {
|
||||||
inputIndex = dequeueInputBuffer(true, true);
|
inputIndex = dequeueInputBuffer(true, true);
|
||||||
|
|||||||
@@ -44,9 +44,9 @@
|
|||||||
<string name="conn_establishing_title">Establishing Connection</string>
|
<string name="conn_establishing_title">Establishing Connection</string>
|
||||||
<string name="conn_establishing_msg">Starting connection</string>
|
<string name="conn_establishing_msg">Starting connection</string>
|
||||||
<string name="conn_metered">Warning: Your active network connection is metered!</string>
|
<string name="conn_metered">Warning: Your active network connection is metered!</string>
|
||||||
<string name="conn_client_latency">Average client-side frame latency:</string>
|
<string name="conn_client_latency">Average frame decoding latency:</string>
|
||||||
<string name="conn_client_latency_hw">hardware decoder latency:</string>
|
<string name="conn_client_latency_hw">hardware decoder latency:</string>
|
||||||
<string name="conn_hardware_latency">Average hardware decoder latency:</string>
|
<string name="conn_hardware_latency">Average hardware decoding latency:</string>
|
||||||
<string name="conn_starting">Starting</string>
|
<string name="conn_starting">Starting</string>
|
||||||
<string name="conn_error_title">Connection Error</string>
|
<string name="conn_error_title">Connection Error</string>
|
||||||
<string name="conn_error_msg">Failed to start</string>
|
<string name="conn_error_msg">Failed to start</string>
|
||||||
|
|||||||
Reference in new issue
Block a user