Park for a bit if there's nothing to do

This commit is contained in:
Cameron Gutman 2014-07-19 03:49:44 -07:00
parent 92143df65c
commit f5ec665115
2 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.concurrent.locks.LockSupport;
import android.graphics.PixelFormat;
import android.os.Build;
@ -169,6 +170,7 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
long diff = nextFrameTime - System.currentTimeMillis();
if (diff > WAIT_CEILING_MS) {
LockSupport.parkNanos(1);
continue;
}

View File

@ -3,6 +3,7 @@ package com.limelight.binding.video;
import java.nio.ByteBuffer;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.locks.LockSupport;
import com.limelight.LimeLog;
import com.limelight.nvstream.av.ByteBufferDescriptor;
@ -203,6 +204,9 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
}
} else {
switch (outIndex) {
case MediaCodec.INFO_TRY_AGAIN_LATER:
LockSupport.parkNanos(1);
break;
case MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED:
LimeLog.info("Output buffers changed");
break;