Fix miscounting IDR frames in video stats

This commit is contained in:
Cameron Gutman 2022-05-29 21:10:41 -05:00
parent 6a34ff2728
commit 5dbf18d66e

View File

@ -770,21 +770,11 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
activeWindowVideoStats.measurementStartTimestamp = SystemClock.uptimeMillis(); activeWindowVideoStats.measurementStartTimestamp = SystemClock.uptimeMillis();
} }
activeWindowVideoStats.totalFramesReceived++;
activeWindowVideoStats.totalFrames++;
int inputBufferIndex; int inputBufferIndex;
ByteBuffer buf; ByteBuffer buf;
long timestampUs = enqueueTimeMs * 1000; long timestampUs = enqueueTimeMs * 1000;
if (!FRAME_RENDER_TIME_ONLY) {
// Count time from first packet received to enqueue time as receive time
// We will count DU queue time as part of decoding, because it is directly
// caused by a slow decoder.
activeWindowVideoStats.totalTimeMs += enqueueTimeMs - receiveTimeMs;
}
if (timestampUs <= lastTimestampUs) { if (timestampUs <= lastTimestampUs) {
// We can't submit multiple buffers with the same timestamp // We can't submit multiple buffers with the same timestamp
// so bump it up by one before queuing // so bump it up by one before queuing
@ -971,6 +961,16 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer implements C
} }
} }
else { else {
activeWindowVideoStats.totalFramesReceived++;
activeWindowVideoStats.totalFrames++;
if (!FRAME_RENDER_TIME_ONLY) {
// Count time from first packet received to enqueue time as receive time
// We will count DU queue time as part of decoding, because it is directly
// caused by a slow decoder.
activeWindowVideoStats.totalTimeMs += enqueueTimeMs - receiveTimeMs;
}
inputBufferIndex = dequeueInputBuffer(); inputBufferIndex = dequeueInputBuffer();
if (inputBufferIndex < 0) { if (inputBufferIndex < 0) {
// We're being torn down now // We're being torn down now