Don't report decoding time for software decoder because it generally doesn't capture the information we want due to CPU overhead

This commit is contained in:
Cameron Gutman 2014-07-12 13:46:39 -07:00
parent d1ef912984
commit 993711ccfe

View File

@ -32,7 +32,6 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
private static final int HIGH_PERF = 3; private static final int HIGH_PERF = 3;
private int totalFrames; private int totalFrames;
private long decoderTimeMs;
private long totalTimeMs; private long totalTimeMs;
private int cpuCount = Runtime.getRuntime().availableProcessors(); private int cpuCount = Runtime.getRuntime().availableProcessors();
@ -200,8 +199,6 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
private boolean submitDecodeUnit(DecodeUnit decodeUnit) { private boolean submitDecodeUnit(DecodeUnit decodeUnit) {
byte[] data; byte[] data;
long timeBeforeDecode = System.currentTimeMillis();
// Use the reserved decoder buffer if this decode unit will fit // Use the reserved decoder buffer if this decode unit will fit
if (decodeUnit.getDataLength() <= DECODER_BUFFER_SIZE) { if (decodeUnit.getDataLength() <= DECODER_BUFFER_SIZE) {
decoderBuffer.clear(); decoderBuffer.clear();
@ -229,7 +226,6 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
// Add delta time to the totals (excluding probable outliers) // Add delta time to the totals (excluding probable outliers)
long delta = timeAfterDecode - decodeUnit.getReceiveTimestamp(); long delta = timeAfterDecode - decodeUnit.getReceiveTimestamp();
if (delta >= 0 && delta < 300) { if (delta >= 0 && delta < 300) {
decoderTimeMs += timeAfterDecode-timeBeforeDecode;
totalTimeMs += delta; totalTimeMs += delta;
totalFrames++; totalFrames++;
} }
@ -245,10 +241,7 @@ public class AndroidCpuDecoderRenderer implements VideoDecoderRenderer {
@Override @Override
public int getAverageDecoderLatency() { public int getAverageDecoderLatency() {
if (totalFrames == 0) { return 0;
return 0;
}
return (int)(decoderTimeMs / totalFrames);
} }
@Override @Override