mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
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:
parent
331c179a88
commit
09165ab870
@ -342,11 +342,11 @@ public final class LibvpxVideoRenderer extends BaseRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void dropBuffer() {
|
private void dropBuffer() {
|
||||||
decoderCounters.droppedOutputBufferCount++;
|
decoderCounters.droppedBufferCount++;
|
||||||
droppedFrames++;
|
droppedFrames++;
|
||||||
consecutiveDroppedFrameCount++;
|
consecutiveDroppedFrameCount++;
|
||||||
decoderCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(
|
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(
|
||||||
consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedOutputBufferCount);
|
consecutiveDroppedFrameCount, decoderCounters.maxConsecutiveDroppedBufferCount);
|
||||||
if (droppedFrames == maxDroppedFramesToNotify) {
|
if (droppedFrames == maxDroppedFramesToNotify) {
|
||||||
maybeNotifyDroppedFrames();
|
maybeNotifyDroppedFrames();
|
||||||
}
|
}
|
||||||
|
@ -53,24 +53,24 @@ public final class DecoderCounters {
|
|||||||
*/
|
*/
|
||||||
public int skippedOutputBufferCount;
|
public int skippedOutputBufferCount;
|
||||||
/**
|
/**
|
||||||
* The number of dropped output buffers.
|
* The number of dropped buffers.
|
||||||
* <p>
|
* <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.
|
* 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>
|
* <p>
|
||||||
* Skipped output buffers are ignored for the purposes of calculating this value.
|
* 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.
|
* The number of times all buffers to a keyframe were dropped.
|
||||||
* <p>
|
* <p>
|
||||||
* Each time buffers to a keyframe are dropped, this counter is increased by one, and the dropped
|
* 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
|
* buffer counters are increased by one (for the current output buffer) plus the number of buffers
|
||||||
* buffers dropped from the source to advance to the keyframe.
|
* dropped from the source to advance to the keyframe.
|
||||||
*/
|
*/
|
||||||
public int droppedToKeyframeCount;
|
public int droppedToKeyframeCount;
|
||||||
|
|
||||||
@ -96,9 +96,9 @@ public final class DecoderCounters {
|
|||||||
skippedInputBufferCount += other.skippedInputBufferCount;
|
skippedInputBufferCount += other.skippedInputBufferCount;
|
||||||
renderedOutputBufferCount += other.renderedOutputBufferCount;
|
renderedOutputBufferCount += other.renderedOutputBufferCount;
|
||||||
skippedOutputBufferCount += other.skippedOutputBufferCount;
|
skippedOutputBufferCount += other.skippedOutputBufferCount;
|
||||||
droppedOutputBufferCount += other.droppedOutputBufferCount;
|
droppedBufferCount += other.droppedBufferCount;
|
||||||
maxConsecutiveDroppedOutputBufferCount = Math.max(maxConsecutiveDroppedOutputBufferCount,
|
maxConsecutiveDroppedBufferCount = Math.max(maxConsecutiveDroppedBufferCount,
|
||||||
other.maxConsecutiveDroppedOutputBufferCount);
|
other.maxConsecutiveDroppedBufferCount);
|
||||||
droppedToKeyframeCount += other.droppedToKeyframeCount;
|
droppedToKeyframeCount += other.droppedToKeyframeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,11 +700,11 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||||||
* @param droppedBufferCount The number of additional dropped buffers.
|
* @param droppedBufferCount The number of additional dropped buffers.
|
||||||
*/
|
*/
|
||||||
protected void updateDroppedBufferCounters(int droppedBufferCount) {
|
protected void updateDroppedBufferCounters(int droppedBufferCount) {
|
||||||
decoderCounters.droppedOutputBufferCount += droppedBufferCount;
|
decoderCounters.droppedBufferCount += droppedBufferCount;
|
||||||
droppedFrames += droppedBufferCount;
|
droppedFrames += droppedBufferCount;
|
||||||
consecutiveDroppedFrameCount += droppedBufferCount;
|
consecutiveDroppedFrameCount += droppedBufferCount;
|
||||||
decoderCounters.maxConsecutiveDroppedOutputBufferCount = Math.max(consecutiveDroppedFrameCount,
|
decoderCounters.maxConsecutiveDroppedBufferCount = Math.max(consecutiveDroppedFrameCount,
|
||||||
decoderCounters.maxConsecutiveDroppedOutputBufferCount);
|
decoderCounters.maxConsecutiveDroppedBufferCount);
|
||||||
if (droppedFrames >= maxDroppedFramesToNotify) {
|
if (droppedFrames >= maxDroppedFramesToNotify) {
|
||||||
maybeNotifyDroppedFrames();
|
maybeNotifyDroppedFrames();
|
||||||
}
|
}
|
||||||
|
@ -154,8 +154,8 @@ public final class DebugTextViewHelper extends Player.DefaultEventListener imple
|
|||||||
return " sib:" + counters.skippedInputBufferCount
|
return " sib:" + counters.skippedInputBufferCount
|
||||||
+ " sb:" + counters.skippedOutputBufferCount
|
+ " sb:" + counters.skippedOutputBufferCount
|
||||||
+ " rb:" + counters.renderedOutputBufferCount
|
+ " rb:" + counters.renderedOutputBufferCount
|
||||||
+ " db:" + counters.droppedOutputBufferCount
|
+ " db:" + counters.droppedBufferCount
|
||||||
+ " mcdb:" + counters.maxConsecutiveDroppedOutputBufferCount
|
+ " mcdb:" + counters.maxConsecutiveDroppedBufferCount
|
||||||
+ " dk:" + counters.droppedToKeyframeCount;
|
+ " dk:" + counters.droppedToKeyframeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,9 +323,9 @@ public final class DashTestRunner {
|
|||||||
metricsLogger.logMetric(MetricsLogger.KEY_TEST_NAME, streamName);
|
metricsLogger.logMetric(MetricsLogger.KEY_TEST_NAME, streamName);
|
||||||
metricsLogger.logMetric(MetricsLogger.KEY_IS_CDD_LIMITED_RETRY, isCddLimitedRetry);
|
metricsLogger.logMetric(MetricsLogger.KEY_IS_CDD_LIMITED_RETRY, isCddLimitedRetry);
|
||||||
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_DROPPED_COUNT,
|
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_DROPPED_COUNT,
|
||||||
videoCounters.droppedOutputBufferCount);
|
videoCounters.droppedBufferCount);
|
||||||
metricsLogger.logMetric(MetricsLogger.KEY_MAX_CONSECUTIVE_FRAMES_DROPPED_COUNT,
|
metricsLogger.logMetric(MetricsLogger.KEY_MAX_CONSECUTIVE_FRAMES_DROPPED_COUNT,
|
||||||
videoCounters.maxConsecutiveDroppedOutputBufferCount);
|
videoCounters.maxConsecutiveDroppedBufferCount);
|
||||||
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_SKIPPED_COUNT,
|
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_SKIPPED_COUNT,
|
||||||
videoCounters.skippedOutputBufferCount);
|
videoCounters.skippedOutputBufferCount);
|
||||||
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_RENDERED_COUNT,
|
metricsLogger.logMetric(MetricsLogger.KEY_FRAMES_RENDERED_COUNT,
|
||||||
@ -343,20 +343,20 @@ public final class DashTestRunner {
|
|||||||
.assertSkippedOutputBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters, 0);
|
.assertSkippedOutputBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters, 0);
|
||||||
// We allow one fewer output buffer due to the way that MediaCodecRenderer and the
|
// 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.
|
// 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);
|
audioCounters.inputBufferCount - 1, audioCounters.inputBufferCount);
|
||||||
DecoderCountersUtil.assertTotalOutputBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters,
|
DecoderCountersUtil.assertTotalBufferCount(tag + VIDEO_TAG_SUFFIX, videoCounters,
|
||||||
videoCounters.inputBufferCount - 1, videoCounters.inputBufferCount);
|
videoCounters.inputBufferCount - 1, videoCounters.inputBufferCount);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
int droppedFrameLimit = (int) Math.ceil(MAX_DROPPED_VIDEO_FRAME_FRACTION
|
int droppedFrameLimit = (int) Math.ceil(MAX_DROPPED_VIDEO_FRAME_FRACTION
|
||||||
* DecoderCountersUtil.getTotalOutputBuffers(videoCounters));
|
* DecoderCountersUtil.getTotalBufferCount(videoCounters));
|
||||||
// Assert that performance is acceptable.
|
// Assert that performance is acceptable.
|
||||||
// Assert that total dropped frames were within limit.
|
// Assert that total dropped frames were within limit.
|
||||||
DecoderCountersUtil.assertDroppedOutputBufferLimit(tag + VIDEO_TAG_SUFFIX, videoCounters,
|
DecoderCountersUtil.assertDroppedBufferLimit(tag + VIDEO_TAG_SUFFIX, videoCounters,
|
||||||
droppedFrameLimit);
|
droppedFrameLimit);
|
||||||
// Assert that consecutive dropped frames were within limit.
|
// 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);
|
videoCounters, MAX_CONSECUTIVE_DROPPED_VIDEO_FRAMES);
|
||||||
} catch (AssertionFailedError e) {
|
} catch (AssertionFailedError e) {
|
||||||
if (trackSelector.includedAdditionalVideoFormats) {
|
if (trackSelector.includedAdditionalVideoFormats) {
|
||||||
|
@ -31,8 +31,9 @@ public final class DecoderCountersUtil {
|
|||||||
* @param counters The counters for which the total should be calculated.
|
* @param counters The counters for which the total should be calculated.
|
||||||
* @return The sum of the skipped, dropped and rendered buffers.
|
* @return The sum of the skipped, dropped and rendered buffers.
|
||||||
*/
|
*/
|
||||||
public static int getTotalOutputBuffers(DecoderCounters counters) {
|
public static int getTotalBufferCount(DecoderCounters counters) {
|
||||||
return counters.skippedOutputBufferCount + counters.droppedOutputBufferCount
|
counters.ensureUpdated();
|
||||||
|
return counters.skippedOutputBufferCount + counters.droppedBufferCount
|
||||||
+ counters.renderedOutputBufferCount;
|
+ counters.renderedOutputBufferCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,26 +45,24 @@ public final class DecoderCountersUtil {
|
|||||||
+ expected + ".", expected, actual);
|
+ expected + ".", expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertTotalOutputBufferCount(String name, DecoderCounters counters,
|
public static void assertTotalBufferCount(String name, DecoderCounters counters, int minCount,
|
||||||
int minCount, int maxCount) {
|
int maxCount) {
|
||||||
counters.ensureUpdated();
|
int actual = getTotalBufferCount(counters);
|
||||||
int actual = getTotalOutputBuffers(counters);
|
|
||||||
TestCase.assertTrue("Codec(" + name + ") output " + actual + " buffers. Expected in range ["
|
TestCase.assertTrue("Codec(" + name + ") output " + actual + " buffers. Expected in range ["
|
||||||
+ minCount + ", " + maxCount + "].", minCount <= actual && actual <= maxCount);
|
+ minCount + ", " + maxCount + "].", minCount <= actual && actual <= maxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertDroppedOutputBufferLimit(String name, DecoderCounters counters,
|
public static void assertDroppedBufferLimit(String name, DecoderCounters counters, int limit) {
|
||||||
int limit) {
|
|
||||||
counters.ensureUpdated();
|
counters.ensureUpdated();
|
||||||
int actual = counters.droppedOutputBufferCount;
|
int actual = counters.droppedBufferCount;
|
||||||
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual + " buffers. "
|
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual + " buffers. "
|
||||||
+ "Limit: " + limit + ".", actual <= limit);
|
+ "Limit: " + limit + ".", actual <= limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void assertConsecutiveDroppedOutputBufferLimit(String name,
|
public static void assertConsecutiveDroppedBufferLimit(String name, DecoderCounters counters,
|
||||||
DecoderCounters counters, int limit) {
|
int limit) {
|
||||||
counters.ensureUpdated();
|
counters.ensureUpdated();
|
||||||
int actual = counters.maxConsecutiveDroppedOutputBufferCount;
|
int actual = counters.maxConsecutiveDroppedBufferCount;
|
||||||
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual
|
TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual
|
||||||
+ " buffers consecutively. " + "Limit: " + limit + ".", actual <= limit);
|
+ " buffers consecutively. " + "Limit: " + limit + ".", actual <= limit);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user