Commit 87457d50 by Oliver Woodman

Add CodecCounters to LibvpxVideoTrackRenderer.

parent d3995eaa
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package com.google.android.exoplayer.ext.vp9; package com.google.android.exoplayer.ext.vp9;
import com.google.android.exoplayer.CodecCounters;
import com.google.android.exoplayer.ExoPlaybackException; import com.google.android.exoplayer.ExoPlaybackException;
import com.google.android.exoplayer.ExoPlayer; import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.MediaFormat; import com.google.android.exoplayer.MediaFormat;
...@@ -89,6 +90,8 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer { ...@@ -89,6 +90,8 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer {
public static final int MSG_SET_SURFACE = 1; public static final int MSG_SET_SURFACE = 1;
public static final int MSG_SET_VPX_SURFACE_VIEW = 2; public static final int MSG_SET_VPX_SURFACE_VIEW = 2;
public final CodecCounters codecCounters = new CodecCounters();
private final boolean scaleToFit; private final boolean scaleToFit;
private final Handler eventHandler; private final Handler eventHandler;
private final EventListener eventListener; private final EventListener eventListener;
...@@ -209,6 +212,7 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer { ...@@ -209,6 +212,7 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer {
if (timeToRenderUs < -30000 || outputBuffer.timestampUs < positionUs) { if (timeToRenderUs < -30000 || outputBuffer.timestampUs < positionUs) {
// Drop frame if we are too late. // Drop frame if we are too late.
codecCounters.droppedOutputBufferCount++;
droppedFrameCount++; droppedFrameCount++;
if (droppedFrameCount == maxDroppedFrameCountToNotify) { if (droppedFrameCount == maxDroppedFrameCountToNotify) {
notifyAndResetDroppedFrameCount(); notifyAndResetDroppedFrameCount();
...@@ -217,7 +221,7 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer { ...@@ -217,7 +221,7 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer {
return; return;
} }
// If we have not renderered any frame so far (either initially or immediately following a // If we have not rendered any frame so far (either initially or immediately following a
// seek), render one frame irresepective of the state. // seek), render one frame irresepective of the state.
if (!renderedFirstFrame) { if (!renderedFirstFrame) {
renderBuffer(); renderBuffer();
...@@ -243,6 +247,7 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer { ...@@ -243,6 +247,7 @@ public final class LibvpxVideoTrackRenderer extends SampleSourceTrackRenderer {
} }
private void renderBuffer() throws VpxDecoderException { private void renderBuffer() throws VpxDecoderException {
codecCounters.renderedOutputBufferCount++;
notifyIfVideoSizeChanged(outputBuffer); notifyIfVideoSizeChanged(outputBuffer);
if (outputRgb) { if (outputRgb) {
renderRgbFrame(outputBuffer, scaleToFit); renderRgbFrame(outputBuffer, scaleToFit);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment