check maximum consecutively dropped frames in video tests
This commit is contained in:
parent
ddaa9092ec
commit
1fc32d56c8
@ -31,6 +31,7 @@ public final class CodecCounters {
|
|||||||
public int renderedOutputBufferCount;
|
public int renderedOutputBufferCount;
|
||||||
public int skippedOutputBufferCount;
|
public int skippedOutputBufferCount;
|
||||||
public int droppedOutputBufferCount;
|
public int droppedOutputBufferCount;
|
||||||
|
public int maxConsecutiveDroppedOutputBufferCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be invoked from the playback thread after the counters have been updated. Should also
|
* Should be invoked from the playback thread after the counters have been updated. Should also
|
||||||
@ -52,6 +53,7 @@ public final class CodecCounters {
|
|||||||
builder.append(" ren:").append(renderedOutputBufferCount);
|
builder.append(" ren:").append(renderedOutputBufferCount);
|
||||||
builder.append(" sob:").append(skippedOutputBufferCount);
|
builder.append(" sob:").append(skippedOutputBufferCount);
|
||||||
builder.append(" dob:").append(droppedOutputBufferCount);
|
builder.append(" dob:").append(droppedOutputBufferCount);
|
||||||
|
builder.append(" mcdob:").append(maxConsecutiveDroppedOutputBufferCount);
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
private long joiningDeadlineUs;
|
private long joiningDeadlineUs;
|
||||||
private long droppedFrameAccumulationStartTimeMs;
|
private long droppedFrameAccumulationStartTimeMs;
|
||||||
private int droppedFrameCount;
|
private int droppedFrameCount;
|
||||||
|
private int consecutiveDroppedFrameCount;
|
||||||
|
|
||||||
private int pendingRotationDegrees;
|
private int pendingRotationDegrees;
|
||||||
private float pendingPixelWidthHeightRatio;
|
private float pendingPixelWidthHeightRatio;
|
||||||
@ -220,6 +221,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
throws ExoPlaybackException {
|
throws ExoPlaybackException {
|
||||||
super.onEnabled(track, positionUs, joining);
|
super.onEnabled(track, positionUs, joining);
|
||||||
renderedFirstFrame = false;
|
renderedFirstFrame = false;
|
||||||
|
consecutiveDroppedFrameCount = 0;
|
||||||
if (joining && allowedJoiningTimeUs > 0) {
|
if (joining && allowedJoiningTimeUs > 0) {
|
||||||
joiningDeadlineUs = SystemClock.elapsedRealtime() * 1000L + allowedJoiningTimeUs;
|
joiningDeadlineUs = SystemClock.elapsedRealtime() * 1000L + allowedJoiningTimeUs;
|
||||||
}
|
}
|
||||||
@ -230,6 +232,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
protected void seekTo(long positionUs) throws ExoPlaybackException {
|
protected void seekTo(long positionUs) throws ExoPlaybackException {
|
||||||
super.seekTo(positionUs);
|
super.seekTo(positionUs);
|
||||||
renderedFirstFrame = false;
|
renderedFirstFrame = false;
|
||||||
|
consecutiveDroppedFrameCount = 0;
|
||||||
joiningDeadlineUs = -1;
|
joiningDeadlineUs = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,6 +380,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
ByteBuffer buffer, MediaCodec.BufferInfo bufferInfo, int bufferIndex, boolean shouldSkip) {
|
ByteBuffer buffer, MediaCodec.BufferInfo bufferInfo, int bufferIndex, boolean shouldSkip) {
|
||||||
if (shouldSkip) {
|
if (shouldSkip) {
|
||||||
skipOutputBuffer(codec, bufferIndex);
|
skipOutputBuffer(codec, bufferIndex);
|
||||||
|
consecutiveDroppedFrameCount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,6 +390,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
} else {
|
} else {
|
||||||
renderOutputBuffer(codec, bufferIndex);
|
renderOutputBuffer(codec, bufferIndex);
|
||||||
}
|
}
|
||||||
|
consecutiveDroppedFrameCount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,6 +421,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
// Let the underlying framework time the release.
|
// Let the underlying framework time the release.
|
||||||
if (earlyUs < 50000) {
|
if (earlyUs < 50000) {
|
||||||
renderOutputBufferV21(codec, bufferIndex, adjustedReleaseTimeNs);
|
renderOutputBufferV21(codec, bufferIndex, adjustedReleaseTimeNs);
|
||||||
|
consecutiveDroppedFrameCount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -432,6 +438,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
renderOutputBuffer(codec, bufferIndex);
|
renderOutputBuffer(codec, bufferIndex);
|
||||||
|
consecutiveDroppedFrameCount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,6 +460,9 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||||||
TraceUtil.endSection();
|
TraceUtil.endSection();
|
||||||
codecCounters.droppedOutputBufferCount++;
|
codecCounters.droppedOutputBufferCount++;
|
||||||
droppedFrameCount++;
|
droppedFrameCount++;
|
||||||
|
consecutiveDroppedFrameCount++;
|
||||||
|
codecCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(consecutiveDroppedFrameCount,
|
||||||
|
codecCounters.maxConsecutiveDroppedOutputBufferCount);
|
||||||
if (droppedFrameCount == maxDroppedFrameCountToNotify) {
|
if (droppedFrameCount == maxDroppedFrameCountToNotify) {
|
||||||
maybeNotifyDroppedFrameCount();
|
maybeNotifyDroppedFrameCount();
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,7 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
|
|||||||
|
|
||||||
private static final long MAX_PLAYING_TIME_DISCREPANCY_MS = 2000;
|
private static final long MAX_PLAYING_TIME_DISCREPANCY_MS = 2000;
|
||||||
private static final float MAX_DROPPED_VIDEO_FRAME_FRACTION = 0.01f;
|
private static final float MAX_DROPPED_VIDEO_FRAME_FRACTION = 0.01f;
|
||||||
|
private static final int MAX_CONSECUTIVE_DROPPED_VIDEO_FRAMES = 10;
|
||||||
|
|
||||||
private static final long MAX_ADDITIONAL_TIME_MS = 180000;
|
private static final long MAX_ADDITIONAL_TIME_MS = 180000;
|
||||||
private static final int MIN_LOADABLE_RETRY_COUNT = 10;
|
private static final int MIN_LOADABLE_RETRY_COUNT = 10;
|
||||||
@ -383,9 +384,13 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assert that the level of performance was acceptable.
|
// Assert that the level of performance was acceptable.
|
||||||
|
// Assert that total dropped frames were within limit.
|
||||||
int droppedFrameLimit = (int) Math.ceil(MAX_DROPPED_VIDEO_FRAME_FRACTION
|
int droppedFrameLimit = (int) Math.ceil(MAX_DROPPED_VIDEO_FRAME_FRACTION
|
||||||
* CodecCountersUtil.getTotalOutputBuffers(videoCounters));
|
* CodecCountersUtil.getTotalOutputBuffers(videoCounters));
|
||||||
CodecCountersUtil.assertDroppedOutputBufferLimit(VIDEO_TAG, videoCounters, droppedFrameLimit);
|
CodecCountersUtil.assertDroppedOutputBufferLimit(VIDEO_TAG, videoCounters, droppedFrameLimit);
|
||||||
|
// Assert that consecutive dropped frames were within limit.
|
||||||
|
CodecCountersUtil.assertConsecutiveDroppedOutputBufferLimit(VIDEO_TAG, videoCounters,
|
||||||
|
MAX_CONSECUTIVE_DROPPED_VIDEO_FRAMES);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class TrackSelector implements DashTrackSelector {
|
private static final class TrackSelector implements DashTrackSelector {
|
||||||
|
@ -77,4 +77,12 @@ public final class CodecCountersUtil {
|
|||||||
+ "Limit: " + limit + ".", actual <= limit);
|
+ "Limit: " + limit + ".", actual <= limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void assertConsecutiveDroppedOutputBufferLimit(String name, CodecCounters counters,
|
||||||
|
int limit) {
|
||||||
|
counters.ensureUpdated();
|
||||||
|
int actual = counters.maxConsecutiveDroppedOutputBufferCount;
|
||||||
|
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual
|
||||||
|
+ " buffers consecutively. " + "Limit: " + limit + ".", actual <= limit);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user