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
@@ -5,9 +5,9 @@ import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection; import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint; import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface; import android.hardware.usb.UsbInterface;
import android.os.SystemClock;
import com.limelight.LimeLog; import com.limelight.LimeLog;
import com.limelight.binding.video.MediaCodecHelper;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@@ -58,7 +58,7 @@ public abstract class AbstractXboxController extends AbstractController {
do { do {
// Read the next input state packet // Read the next input state packet
long lastMillis = MediaCodecHelper.getMonotonicMillis(); long lastMillis = SystemClock.uptimeMillis();
res = connection.bulkTransfer(inEndpt, buffer, buffer.length, 3000); res = connection.bulkTransfer(inEndpt, buffer, buffer.length, 3000);
// If we get a zero length response, treat it as an error // If we get a zero length response, treat it as an error
@@ -66,7 +66,7 @@ public abstract class AbstractXboxController extends AbstractController {
res = -1; res = -1;
} }
if (res == -1 && MediaCodecHelper.getMonotonicMillis() - lastMillis < 1000) { if (res == -1 && SystemClock.uptimeMillis() - lastMillis < 1000) {
LimeLog.warning("Detected device I/O error"); LimeLog.warning("Detected device I/O error");
AbstractXboxController.this.stop(); AbstractXboxController.this.stop();
break; break;
@@ -651,7 +651,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
} }
// Add delta time to the totals (excluding probable outliers) // 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) { if (delta >= 0 && delta < 1000) {
activeWindowVideoStats.decoderTimeMs += delta; activeWindowVideoStats.decoderTimeMs += delta;
if (!USE_FRAME_RENDER_TIME) { if (!USE_FRAME_RENDER_TIME) {
@@ -686,7 +686,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
int index = -1; int index = -1;
long startTime; long startTime;
startTime = MediaCodecHelper.getMonotonicMillis(); startTime = SystemClock.uptimeMillis();
try { try {
while (index < 0 && !stopping) { while (index < 0 && !stopping) {
@@ -697,7 +697,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
return MediaCodec.INFO_TRY_AGAIN_LATER; return MediaCodec.INFO_TRY_AGAIN_LATER;
} }
int deltaMs = (int)(MediaCodecHelper.getMonotonicMillis() - startTime); int deltaMs = (int)(SystemClock.uptimeMillis() - startTime);
if (deltaMs >= 20) { if (deltaMs >= 20) {
LimeLog.warning("Dequeue input buffer ran long: " + deltaMs + " ms"); LimeLog.warning("Dequeue input buffer ran long: " + deltaMs + " ms");
@@ -400,10 +400,6 @@ public class MediaCodecHelper {
return false; return false;
} }
public static long getMonotonicMillis() {
return System.nanoTime() / 1000000L;
}
private static boolean decoderSupportsAndroidRLowLatency(MediaCodecInfo decoderInfo, String mimeType) { private static boolean decoderSupportsAndroidRLowLatency(MediaCodecInfo decoderInfo, String mimeType) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try { try {