Add logging for ExtTexMgr

- Number of frames from SurfaceTexture that is sent downstream
- Times ExtTexMgr signaled end of current input stream

PiperOrigin-RevId: 534487842
This commit is contained in:
claincly 2023-05-23 19:08:30 +01:00 committed by tonihei
parent 7c477589e5
commit d584a772e3
2 changed files with 32 additions and 0 deletions

View File

@ -49,6 +49,14 @@ public final class DebugTraceUtil {
private static final Queue<Long> VIDEO_FRAME_PROCESSOR_RECEIVE_DECODER_EOS_TIMES_MS =
new ArrayDeque<>();
/**
* The timestamps at which {@code ExternalTextureManager} signalled end of current input stream,
* in milliseconds.
*/
@GuardedBy("DebugTraceUtil.class")
private static final Queue<Long> EXTERNAL_TEXTURE_MANAGER_SIGNAL_EOCIS_TIMES_MS =
new ArrayDeque<>();
/**
* The timestamps at which {@code VideoFrameProcessor} signalled end of stream, in milliseconds.
*/
@ -82,6 +90,13 @@ public final class DebugTraceUtil {
@GuardedBy("DebugTraceUtil.class")
private static int numberOfFramesRenderedToVideoFrameProcessorInput = 0;
/**
* The number of frames sent to the {@link GlShaderProgram} after they arrive on {@code
* VideoFrameProcessor}'s input surface.
*/
@GuardedBy("DebugTraceUtil.class")
private static int numberOfFramesDequeuedFromVideoProcessorInput = 0;
/** The number of frames rendered to {@code VideoFrameProcessor}'s output. */
@GuardedBy("DebugTraceUtil.class")
private static int numberOfFramesRenderedToVideoFrameProcessorOutput = 0;
@ -100,12 +115,14 @@ public final class DebugTraceUtil {
latestVideoInputFormat = null;
numberOfDecodedFrames = 0;
numberOfFramesRenderedToVideoFrameProcessorInput = 0;
numberOfFramesDequeuedFromVideoProcessorInput = 0;
numberOfFramesRenderedToVideoFrameProcessorOutput = 0;
numberOfEncodedFrames = 0;
numberOfMuxedFrames = 0;
DECODER_RECEIVE_EOS_TIMES_MS.clear();
DECODER_SIGNAL_EOS_TIMES_MS.clear();
VIDEO_FRAME_PROCESSOR_RECEIVE_DECODER_EOS_TIMES_MS.clear();
EXTERNAL_TEXTURE_MANAGER_SIGNAL_EOCIS_TIMES_MS.clear();
VIDEO_FRAME_PROCESSOR_SIGNAL_EOS_TIMES_MS.clear();
ENCODER_RECEIVE_EOS_TIMES_MS.clear();
MUXER_CAN_WRITE_VIDEO_SAMPLE.clear();
@ -124,6 +141,10 @@ public final class DebugTraceUtil {
numberOfFramesRenderedToVideoFrameProcessorInput++;
}
public static synchronized void recordFrameDequeuedFromVideoFrameProcessorInput() {
numberOfFramesDequeuedFromVideoProcessorInput++;
}
public static synchronized void recordFrameRenderedToVideoFrameProcessorOutput() {
numberOfFramesRenderedToVideoFrameProcessorOutput++;
}
@ -150,6 +171,10 @@ public final class DebugTraceUtil {
VIDEO_FRAME_PROCESSOR_RECEIVE_DECODER_EOS_TIMES_MS.add(SystemClock.DEFAULT.elapsedRealtime());
}
public static synchronized void recordExternalInputManagerSignalEndOfCurrentInputStream() {
EXTERNAL_TEXTURE_MANAGER_SIGNAL_EOCIS_TIMES_MS.add(SystemClock.DEFAULT.elapsedRealtime());
}
public static synchronized void recordVideoFrameProcessorSignalEos() {
VIDEO_FRAME_PROCESSOR_SIGNAL_EOS_TIMES_MS.add(SystemClock.DEFAULT.elapsedRealtime());
}
@ -181,6 +206,8 @@ public final class DebugTraceUtil {
+ numberOfDecodedFrames
+ ", Rendered to VFP: "
+ numberOfFramesRenderedToVideoFrameProcessorInput
+ ", Rendered to GlSP: "
+ numberOfFramesDequeuedFromVideoProcessorInput
+ ", Rendered to encoder: "
+ numberOfFramesRenderedToVideoFrameProcessorOutput
+ ", Encoded: "
@ -193,6 +220,8 @@ public final class DebugTraceUtil {
+ generateString(DECODER_SIGNAL_EOS_TIMES_MS)
+ ", VFP receive EOS: "
+ generateString(VIDEO_FRAME_PROCESSOR_RECEIVE_DECODER_EOS_TIMES_MS)
+ ", VFP ExtTexMgr signal EndOfCurrentInputStream: "
+ generateString(EXTERNAL_TEXTURE_MANAGER_SIGNAL_EOCIS_TIMES_MS)
+ ", VFP signal EOS: "
+ generateString(VIDEO_FRAME_PROCESSOR_SIGNAL_EOS_TIMES_MS)
+ ", Encoder receive EOS: "

View File

@ -137,6 +137,7 @@ import java.util.concurrent.atomic.AtomicInteger;
// Reset because there could be further input streams after the current one ends.
currentInputStreamEnded = false;
externalShaderProgram.signalEndOfCurrentInputStream();
DebugTraceUtil.recordExternalInputManagerSignalEndOfCurrentInputStream();
} else {
maybeQueueFrameToExternalShaderProgram();
}
@ -183,6 +184,7 @@ import java.util.concurrent.atomic.AtomicInteger;
() -> {
if (pendingFrames.isEmpty() && currentFrame == null) {
externalShaderProgram.signalEndOfCurrentInputStream();
DebugTraceUtil.recordExternalInputManagerSignalEndOfCurrentInputStream();
} else {
currentInputStreamEnded = true;
}
@ -251,6 +253,7 @@ import java.util.concurrent.atomic.AtomicInteger;
currentFrame.height),
presentationTimeUs);
checkStateNotNull(pendingFrames.remove());
DebugTraceUtil.recordFrameDequeuedFromVideoFrameProcessorInput();
// If the queued frame is the last frame, end of stream will be signaled onInputFrameProcessed.
}
}