mirror of
https://github.com/androidx/media.git
synced 2025-05-11 17:49:52 +08:00
Transformer: Add latest input format to DebugTraceUtil
This can provide more information to help debug muxer errors PiperOrigin-RevId: 531521974 (cherry picked from commit 2736b118458c1ead0cbac2457700c1333f7c86c7)
This commit is contained in:
parent
932bed1f79
commit
2ab9c0c556
@ -17,7 +17,9 @@
|
|||||||
package androidx.media3.effect;
|
package androidx.media3.effect;
|
||||||
|
|
||||||
import androidx.annotation.GuardedBy;
|
import androidx.annotation.GuardedBy;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
|
import androidx.media3.common.Format;
|
||||||
import androidx.media3.common.util.SystemClock;
|
import androidx.media3.common.util.SystemClock;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -68,6 +70,10 @@ public final class DebugTraceUtil {
|
|||||||
@GuardedBy("DebugTraceUtil.class")
|
@GuardedBy("DebugTraceUtil.class")
|
||||||
private static final Queue<Long> MUXER_TRACK_END_TIMES_MS = new ArrayDeque<>();
|
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. */
|
/** The number of decoded frames. */
|
||||||
@GuardedBy("DebugTraceUtil.class")
|
@GuardedBy("DebugTraceUtil.class")
|
||||||
private static int numberOfDecodedFrames = 0;
|
private static int numberOfDecodedFrames = 0;
|
||||||
@ -91,6 +97,7 @@ public final class DebugTraceUtil {
|
|||||||
private DebugTraceUtil() {}
|
private DebugTraceUtil() {}
|
||||||
|
|
||||||
public static synchronized void reset() {
|
public static synchronized void reset() {
|
||||||
|
latestVideoInputFormat = null;
|
||||||
numberOfDecodedFrames = 0;
|
numberOfDecodedFrames = 0;
|
||||||
numberOfFramesRenderedToVideoFrameProcessorInput = 0;
|
numberOfFramesRenderedToVideoFrameProcessorInput = 0;
|
||||||
numberOfFramesRenderedToVideoFrameProcessorOutput = 0;
|
numberOfFramesRenderedToVideoFrameProcessorOutput = 0;
|
||||||
@ -105,6 +112,10 @@ public final class DebugTraceUtil {
|
|||||||
MUXER_TRACK_END_TIMES_MS.clear();
|
MUXER_TRACK_END_TIMES_MS.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static synchronized void recordLatestVideoInputFormat(Format format) {
|
||||||
|
latestVideoInputFormat = format;
|
||||||
|
}
|
||||||
|
|
||||||
public static synchronized void recordDecodedFrame() {
|
public static synchronized void recordDecodedFrame() {
|
||||||
numberOfDecodedFrames++;
|
numberOfDecodedFrames++;
|
||||||
}
|
}
|
||||||
@ -164,7 +175,9 @@ public final class DebugTraceUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized String generateTrace() {
|
public static synchronized String generateTrace() {
|
||||||
return "Decoded: "
|
return "Video input format: "
|
||||||
|
+ latestVideoInputFormat
|
||||||
|
+ ", Decoded: "
|
||||||
+ numberOfDecodedFrames
|
+ numberOfDecodedFrames
|
||||||
+ ", Rendered to VFP: "
|
+ ", Rendered to VFP: "
|
||||||
+ numberOfFramesRenderedToVideoFrameProcessorInput
|
+ numberOfFramesRenderedToVideoFrameProcessorInput
|
||||||
|
@ -71,6 +71,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onInputFormatRead(Format inputFormat) {
|
protected void onInputFormatRead(Format inputFormat) {
|
||||||
|
DebugTraceUtil.recordLatestVideoInputFormat(inputFormat);
|
||||||
if (flattenForSlowMotion) {
|
if (flattenForSlowMotion) {
|
||||||
sefVideoSlowMotionFlattener = new SefSlowMotionFlattener(inputFormat);
|
sefVideoSlowMotionFlattener = new SefSlowMotionFlattener(inputFormat);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user