Rename droppedOutputBufferCount

Now this counter includes input buffers too, which are dropped as part of
skipping to keyframes for catch up.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171119930
This commit is contained in:
andrewlewis 2017-07-15 00:49:09 +01:00 committed by Oliver Woodman
parent 331c179a88
commit 09165ab870
6 changed files with 36 additions and 37 deletions

View File

@ -342,11 +342,11 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
}
private void dropBuffer() {
decoderCounters.droppedOutputBufferCount++;
decoderCounters.droppedBufferCount++;
droppedFrames++;
consecutiveDroppedFrameCount++;
decoderCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(
consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedOutputBufferCount);
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(
consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedBufferCount);
if (droppedFrames == maxDroppedFramesToNotify) {
maybeNotifyDroppedFrames();
}

View File

@ -53,24 +53,24 @@ public final class DecoderCounters {
*/
public int skippedOutputBufferCount;
/**
* The number of dropped output buffers.
* The number of dropped buffers.
* <p>
* A dropped output buffer is an output buffer that was supposed to be rendered, but was instead
* A dropped buffer is an buffer that was supposed to be decoded/rendered, but was instead
* dropped because it could not be rendered in time.
*/
public int droppedOutputBufferCount;
public int droppedBufferCount;
/**
* The maximum number of dropped output buffers without an interleaving rendered output buffer.
* The maximum number of dropped buffers without an interleaving rendered output buffer.
* <p>
* Skipped output buffers are ignored for the purposes of calculating this value.
*/
public int maxConsecutiveDroppedOutputBufferCount;
public int maxConsecutiveDroppedBufferCount;
/**
* The number of times all buffers to a keyframe were dropped.
* <p>
* Each time buffers to a keyframe are dropped, this counter is increased by one, and the dropped
* output buffer counters are increased by one (for the current output buffer) plus the number of
* buffers dropped from the source to advance to the keyframe.
* buffer counters are increased by one (for the current output buffer) plus the number of buffers
* dropped from the source to advance to the keyframe.
*/
public int droppedToKeyframeCount;
@ -96,9 +96,9 @@ public final class DecoderCounters {
skippedInputBufferCount += other.skippedInputBufferCount;
renderedOutputBufferCount += other.renderedOutputBufferCount;
skippedOutputBufferCount += other.skippedOutputBufferCount;
droppedOutputBufferCount += other.droppedOutputBufferCount;
maxConsecutiveDroppedOutputBufferCount = Math.max(maxConsecutiveDroppedOutputBufferCount,
other.maxConsecutiveDroppedOutputBufferCount);
droppedBufferCount += other.droppedBufferCount;
maxConsecutiveDroppedBufferCount = Math.max(maxConsecutiveDroppedBufferCount,
other.maxConsecutiveDroppedBufferCount);
droppedToKeyframeCount += other.droppedToKeyframeCount;
}

View File

@ -700,11 +700,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
* @param droppedBufferCount The number of additional dropped buffers.
*/
protected void updateDroppedBufferCounters(int droppedBufferCount) {
decoderCounters.droppedOutputBufferCount += droppedBufferCount;
decoderCounters.droppedBufferCount += droppedBufferCount;
droppedFrames += droppedBufferCount;
consecutiveDroppedFrameCount += droppedBufferCount;
decoderCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(consecutiveDroppedFrameCount,
decoderCounters.maxConsecutiveDroppedOutputBufferCount);
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(consecutiveDroppedFrameCount,
decoderCounters.maxConsecutiveDroppedBufferCount);
if (droppedFrames >= maxDroppedFramesToNotify) {
maybeNotifyDroppedFrames();
}

View File

@ -154,8 +154,8 @@ public final class DebugTextViewHelper extends Player.DefaultEventListener imple
return " sib:" + counters.skippedInputBufferCount
+ " sb:" + counters.skippedOutputBufferCount
+ " rb:" + counters.renderedOutputBufferCount
+ " db:" + counters.droppedOutputBufferCount
+ " mcdb:" + counters.maxConsecutiveDroppedOutputBufferCount
+ " db:" + counters.droppedBufferCount
+ " mcdb:" + counters.maxConsecutiveDroppedBufferCount
+ " dk:" + counters.droppedToKeyframeCount;
}

View File

@ -323,9 +323,9 @@ public final class DashTestRunner {
metricsLogger.logMetric(MetricsLogger.KEY_TEST_NAME, streamName);
metricsLogger.logMetric(MetricsLogger.KEY_IS_CDD_LIMITED_RETRY, isCddLimitedRetry);
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_DROPPED_COUNT,
videoCounters.droppedOutputBufferCount);
videoCounters.droppedBufferCount);
metricsLogger.logMetric(MetricsLogger.KEY_MAX_CONSECUTIVE_FRAMES_DROPPED_COUNT,
videoCounters.maxConsecutiveDroppedOutputBufferCount);
videoCounters.maxConsecutiveDroppedBufferCount);
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_SKIPPED_COUNT,
videoCounters.skippedOutputBufferCount);
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_RENDERED_COUNT,
@ -343,20 +343,20 @@ public final class DashTestRunner {
.assertSkippedOutputBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters, 0);
// We allow one fewer output buffer due to the way that MediaCodecRenderer and the
// underlying decoders handle the end of stream. This should be tightened up in the future.
DecoderCountersUtil.assertTotalOutputBufferCount(tag + AUDIO_TAG_SUFFIX, audioCounters,
DecoderCountersUtil.assertTotalBufferCount(tag + AUDIO_TAG_SUFFIX, audioCounters,
audioCounters.inputBufferCount - 1, audioCounters.inputBufferCount);
DecoderCountersUtil.assertTotalOutputBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters,
DecoderCountersUtil.assertTotalBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters,
videoCounters.inputBufferCount - 1, videoCounters.inputBufferCount);
}
try {
int droppedFrameLimit = (int) Math.ceil(MAX_DROPPED_VIDEO_FRAME_FRACTION
* DecoderCountersUtil.getTotalOutputBuffers(videoCounters));
* DecoderCountersUtil.getTotalBufferCount(videoCounters));
// Assert that performance is acceptable.
// Assert that total dropped frames were within limit.
DecoderCountersUtil.assertDroppedOutputBufferLimit(tag + VIDEO_TAG_SUFFIX, videoCounters,
DecoderCountersUtil.assertDroppedBufferLimit(tag + VIDEO_TAG_SUFFIX, videoCounters,
droppedFrameLimit);
// Assert that consecutive dropped frames were within limit.
DecoderCountersUtil.assertConsecutiveDroppedOutputBufferLimit(tag + VIDEO_TAG_SUFFIX,
DecoderCountersUtil.assertConsecutiveDroppedBufferLimit(tag + VIDEO_TAG_SUFFIX,
videoCounters, MAX_CONSECUTIVE_DROPPED_VIDEO_FRAMES);
} catch (AssertionFailedError e) {
if (trackSelector.includedAdditionalVideoFormats) {

View File

@ -31,8 +31,9 @@ public final class DecoderCountersUtil {
* @param counters The counters for which the total should be calculated.
* @return The sum of the skipped, dropped and rendered buffers.
*/
public static int getTotalOutputBuffers(DecoderCounters counters) {
return counters.skippedOutputBufferCount + counters.droppedOutputBufferCount
public static int getTotalBufferCount(DecoderCounters counters) {
counters.ensureUpdated();
return counters.skippedOutputBufferCount + counters.droppedBufferCount
+ counters.renderedOutputBufferCount;
}
@ -44,26 +45,24 @@ public final class DecoderCountersUtil {
+ expected + ".", expected, actual);
}
public static void assertTotalOutputBufferCount(String name, DecoderCounters counters,
int minCount, int maxCount) {
counters.ensureUpdated();
int actual = getTotalOutputBuffers(counters);
public static void assertTotalBufferCount(String name, DecoderCounters counters, int minCount,
int maxCount) {
int actual = getTotalBufferCount(counters);
TestCase.assertTrue("Codec(" + name + ") output " + actual + " buffers. Expected in range ["
+ minCount + ", " + maxCount + "].", minCount <= actual && actual <= maxCount);
}
public static void assertDroppedOutputBufferLimit(String name, DecoderCounters counters,
int limit) {
public static void assertDroppedBufferLimit(String name, DecoderCounters counters, int limit) {
counters.ensureUpdated();
int actual = counters.droppedOutputBufferCount;
int actual = counters.droppedBufferCount;
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual + " buffers. "
+ "Limit: " + limit + ".", actual <= limit);
}
public static void assertConsecutiveDroppedOutputBufferLimit(String name,
DecoderCounters counters, int limit) {
public static void assertConsecutiveDroppedBufferLimit(String name, DecoderCounters counters,
int limit) {
counters.ensureUpdated();
int actual = counters.maxConsecutiveDroppedOutputBufferCount;
int actual = counters.maxConsecutiveDroppedBufferCount;
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual
+ " buffers consecutively. " + "Limit: " + limit + ".", actual <= limit);
}