Commit 4a0660f9 by claincly Committed by Tofunmi Adigun-Hameed

Add logging for ExtTexMgr

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

PiperOrigin-RevId: 534487842
(cherry picked from commit d21bf0ee89c40bd0d94107b9d1e74874438aa869)
parent dea13909
......@@ -48,6 +48,14 @@ public final class DebugTraceUtil {
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.
*/
@GuardedBy("DebugTraceUtil.class")
......@@ -80,6 +88,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;
......@@ -98,12 +113,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();
......@@ -122,6 +139,10 @@ public final class DebugTraceUtil {
numberOfFramesRenderedToVideoFrameProcessorInput++;
}
public static synchronized void recordFrameDequeuedFromVideoFrameProcessorInput() {
numberOfFramesDequeuedFromVideoProcessorInput++;
}
public static synchronized void recordFrameRenderedToVideoFrameProcessorOutput() {
numberOfFramesRenderedToVideoFrameProcessorOutput++;
}
......@@ -148,6 +169,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());
}
......@@ -179,6 +204,8 @@ public final class DebugTraceUtil {
+ numberOfDecodedFrames
+ ", Rendered to VFP: "
+ numberOfFramesRenderedToVideoFrameProcessorInput
+ ", Rendered to GlSP: "
+ numberOfFramesDequeuedFromVideoProcessorInput
+ ", Rendered to encoder: "
+ numberOfFramesRenderedToVideoFrameProcessorOutput
+ ", Encoded: "
......@@ -191,6 +218,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: "
......
......@@ -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.
}
}
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