mirror of
https://github.com/androidx/media.git
synced 2025-05-04 06:00:37 +08:00
Add CodecCounters to LibvpxVideoTrackRenderer.
This commit is contained in:
parent
d3995eaa7a
commit
87457d5042
@ -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 {
|
|||||||
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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user