Remove MediaCodecHelper.getMonotonicMillis()

This commit is contained in:
Cameron Gutman
2022-08-02 18:08:12 -05:00
parent eb2e79977d
commit 0fbb53c606
3 changed files with 6 additions and 10 deletions

View File

@@ -5,9 +5,9 @@ import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.os.SystemClock;
import com.limelight.LimeLog;
import com.limelight.binding.video.MediaCodecHelper;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -58,7 +58,7 @@ public abstract class AbstractXboxController extends AbstractController {
do {
// Read the next input state packet
long lastMillis = MediaCodecHelper.getMonotonicMillis();
long lastMillis = SystemClock.uptimeMillis();
res = connection.bulkTransfer(inEndpt, buffer, buffer.length, 3000);
// If we get a zero length response, treat it as an error
@@ -66,7 +66,7 @@ public abstract class AbstractXboxController extends AbstractController {
res = -1;
}
if (res == -1 && MediaCodecHelper.getMonotonicMillis() - lastMillis < 1000) {
if (res == -1 && SystemClock.uptimeMillis() - lastMillis < 1000) {
LimeLog.warning("Detected device I/O error");
AbstractXboxController.this.stop();
break;

View File

@@ -651,7 +651,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
}
// Add delta time to the totals (excluding probable outliers)
long delta = MediaCodecHelper.getMonotonicMillis() - (presentationTimeUs / 1000);
long delta = SystemClock.uptimeMillis() - (presentationTimeUs / 1000);
if (delta >= 0 && delta < 1000) {
activeWindowVideoStats.decoderTimeMs += delta;
if (!USE_FRAME_RENDER_TIME) {
@@ -686,7 +686,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
int index = -1;
long startTime;
startTime = MediaCodecHelper.getMonotonicMillis();
startTime = SystemClock.uptimeMillis();
try {
while (index < 0 && !stopping) {
@@ -697,7 +697,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
return MediaCodec.INFO_TRY_AGAIN_LATER;
}
int deltaMs = (int)(MediaCodecHelper.getMonotonicMillis() - startTime);
int deltaMs = (int)(SystemClock.uptimeMillis() - startTime);
if (deltaMs >= 20) {
LimeLog.warning("Dequeue input buffer ran long: " + deltaMs + " ms");

View File

@@ -400,10 +400,6 @@ public class MediaCodecHelper {
return false;
}
public static long getMonotonicMillis() {
return System.nanoTime() / 1000000L;
}
private static boolean decoderSupportsAndroidRLowLatency(MediaCodecInfo decoderInfo, String mimeType) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {