Report dropped frames from the VideoSink
After 4fad529433
, MediaCodecVideoRenderer does not report if frames
are dropped from the VideoSink. This commit fixes this.
#minor-release
PiperOrigin-RevId: 571905721
This commit is contained in:
parent
3ed7e561bb
commit
05b17b5430
@ -552,7 +552,9 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private void releaseProcessedFrameInternal(long releaseTimeNs, boolean isLastFrame) {
|
||||
videoFrameProcessor.renderOutputFrame(releaseTimeNs);
|
||||
processedFramesBufferTimestampsUs.remove();
|
||||
if (releaseTimeNs != VideoFrameProcessor.DROP_OUTPUT_FRAME) {
|
||||
if (releaseTimeNs == VideoFrameProcessor.DROP_OUTPUT_FRAME) {
|
||||
renderControl.onFrameDropped();
|
||||
} else {
|
||||
renderControl.onFrameRendered();
|
||||
if (!renderedFirstFrame) {
|
||||
if (listener != null) {
|
||||
|
@ -564,6 +564,12 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer implements Video
|
||||
lastRenderRealtimeUs = Util.msToUs(getClock().elapsedRealtime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFrameDropped() {
|
||||
updateDroppedBufferCounters(
|
||||
/* droppedInputBufferCount= */ 0, /* droppedDecoderBufferCount= */ 1);
|
||||
}
|
||||
|
||||
// Other methods
|
||||
|
||||
/**
|
||||
|
@ -100,6 +100,9 @@ import java.util.concurrent.Executor;
|
||||
|
||||
/** Informs the rendering control that a video frame was rendered. */
|
||||
void onFrameRendered();
|
||||
|
||||
/** Informs the rendering control that a video frame was dropped. */
|
||||
void onFrameDropped();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,5 +175,8 @@ public final class CompositingVideoSinkProviderTest {
|
||||
|
||||
@Override
|
||||
public void onFrameRendered() {}
|
||||
|
||||
@Override
|
||||
public void onFrameDropped() {}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user