Disable latency tracking due to performance problems

This commit is contained in:
Cameron Gutman 2014-06-30 21:23:45 -07:00
parent a639143e94
commit 3dd57e9f38

View File

@ -28,10 +28,6 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
private boolean needsSpsNumRefFixup; private boolean needsSpsNumRefFixup;
private VideoDepacketizer depacketizer; private VideoDepacketizer depacketizer;
private long totalTimeMs;
private long decoderTimeMs;
private int totalFrames;
private final static byte[] BITSTREAM_RESTRICTIONS = new byte[] {(byte) 0xF1, (byte) 0x83, 0x2A, 0x00}; private final static byte[] BITSTREAM_RESTRICTIONS = new byte[] {(byte) 0xF1, (byte) 0x83, 0x2A, 0x00};
public static final List<String> blacklistedDecoderPrefixes; public static final List<String> blacklistedDecoderPrefixes;
@ -183,13 +179,6 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
if (outIndex >= 0) { if (outIndex >= 0) {
int lastIndex = outIndex; int lastIndex = outIndex;
// Add delta time to the totals (excluding probable outliers)
long delta = System.currentTimeMillis()-info.presentationTimeUs;
if (delta > 5 && delta < 300) {
decoderTimeMs += delta;
totalTimeMs += delta;
}
// Get the last output buffer in the queue // Get the last output buffer in the queue
while ((outIndex = videoDecoder.dequeueOutputBuffer(info, 0)) >= 0) { while ((outIndex = videoDecoder.dequeueOutputBuffer(info, 0)) >= 0) {
videoDecoder.releaseOutputBuffer(lastIndex, false); videoDecoder.releaseOutputBuffer(lastIndex, false);
@ -248,13 +237,6 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
{ {
ByteBuffer buf = videoDecoderInputBuffers[inputIndex]; ByteBuffer buf = videoDecoderInputBuffers[inputIndex];
long currentTime = System.currentTimeMillis();
long delta = currentTime-decodeUnit.getReceiveTimestamp();
if (delta >= 0 && delta < 300) {
totalTimeMs += currentTime-decodeUnit.getReceiveTimestamp();
totalFrames++;
}
// Clear old input data // Clear old input data
buf.clear(); buf.clear();
@ -327,7 +309,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
videoDecoder.queueInputBuffer(inputIndex, videoDecoder.queueInputBuffer(inputIndex,
0, spsLength, 0, spsLength,
currentTime, codecFlags); 0, codecFlags);
return true; return true;
} }
} }
@ -340,7 +322,7 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
videoDecoder.queueInputBuffer(inputIndex, videoDecoder.queueInputBuffer(inputIndex,
0, decodeUnit.getDataLength(), 0, decodeUnit.getDataLength(),
currentTime, codecFlags); 0, codecFlags);
} }
return true; return true;
@ -432,11 +414,11 @@ public class MediaCodecDecoderRenderer implements VideoDecoderRenderer {
@Override @Override
public int getAverageDecoderLatency() { public int getAverageDecoderLatency() {
return (int)(decoderTimeMs / totalFrames); return 0;
} }
@Override @Override
public int getAverageEndToEndLatency() { public int getAverageEndToEndLatency() {
return (int)(totalTimeMs / totalFrames); return 0;
} }
} }