Commit 14c52b4c by huangdarwin Committed by Tofunmi Adigun-Hameed

Transformer: Add latest input format to DebugTraceUtil

This can provide more information to help debug muxer errors

PiperOrigin-RevId: 531521974
(cherry picked from commit baeab6d06446cbfa2df33c30e6cf33084d031495)
parent 2bc64f9b
......@@ -17,7 +17,9 @@
package com.google.android.exoplayer2.effect;
import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.util.SystemClock;
import com.google.android.exoplayer2.util.Util;
import com.google.common.base.Joiner;
......@@ -66,6 +68,10 @@ public final class DebugTraceUtil {
@GuardedBy("DebugTraceUtil.class")
private static final Queue<Long> MUXER_TRACK_END_TIMES_MS = new ArrayDeque<>();
/** The input {@link Format} of the latest media item. */
@GuardedBy("DebugTraceUtil.class")
private static @Nullable Format latestVideoInputFormat = null;
/** The number of decoded frames. */
@GuardedBy("DebugTraceUtil.class")
private static int numberOfDecodedFrames = 0;
......@@ -89,6 +95,7 @@ public final class DebugTraceUtil {
private DebugTraceUtil() {}
public static synchronized void reset() {
latestVideoInputFormat = null;
numberOfDecodedFrames = 0;
numberOfFramesRenderedToVideoFrameProcessorInput = 0;
numberOfFramesRenderedToVideoFrameProcessorOutput = 0;
......@@ -103,6 +110,10 @@ public final class DebugTraceUtil {
MUXER_TRACK_END_TIMES_MS.clear();
}
public static synchronized void recordLatestVideoInputFormat(Format format) {
latestVideoInputFormat = format;
}
public static synchronized void recordDecodedFrame() {
numberOfDecodedFrames++;
}
......@@ -162,7 +173,9 @@ public final class DebugTraceUtil {
}
public static synchronized String generateTrace() {
return "Decoded: "
return "Video input format: "
+ latestVideoInputFormat
+ ", Decoded: "
+ numberOfDecodedFrames
+ ", Rendered to VFP: "
+ numberOfFramesRenderedToVideoFrameProcessorInput
......
......@@ -71,6 +71,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
@Override
protected void onInputFormatRead(Format inputFormat) {
DebugTraceUtil.recordLatestVideoInputFormat(inputFormat);
if (flattenForSlowMotion) {
sefVideoSlowMotionFlattener = new SefSlowMotionFlattener(inputFormat);
}
......
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