mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
Fix frame pacing issues on Snapdragon. Improve latency on Tegra (not perfect still).
This commit is contained in:
parent
79db2ed584
commit
10165f3166
@ -354,6 +354,7 @@ public class NvVideoStream {
|
|||||||
|
|
||||||
private void outputDisplayLoop(Thread t)
|
private void outputDisplayLoop(Thread t)
|
||||||
{
|
{
|
||||||
|
long nextFrameTimeUs = 0;
|
||||||
while (!t.isInterrupted())
|
while (!t.isInterrupted())
|
||||||
{
|
{
|
||||||
BufferInfo info = new BufferInfo();
|
BufferInfo info = new BufferInfo();
|
||||||
@ -370,8 +371,23 @@ public class NvVideoStream {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (outIndex >= 0) {
|
if (outIndex >= 0) {
|
||||||
videoDecoder.releaseOutputBuffer(outIndex, true);
|
boolean render = false;
|
||||||
|
|
||||||
|
if (currentTimeUs() >= nextFrameTimeUs) {
|
||||||
|
render = true;
|
||||||
|
nextFrameTimeUs = computePresentationTime(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
videoDecoder.releaseOutputBuffer(outIndex, render);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static long currentTimeUs() {
|
||||||
|
return System.nanoTime() / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
private long computePresentationTime(int frameRate) {
|
||||||
|
return currentTimeUs() + (1000000 / frameRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user