Add a new debug trace log to log the device name / sdk

PiperOrigin-RevId: 650567544
This commit is contained in:
claincly 2024-07-09 03:46:10 -07:00 committed by Copybara-Service
parent 6650270a4e
commit 60359c16da
2 changed files with 14 additions and 0 deletions

View File

@ -60,6 +60,7 @@ public final class DebugTraceUtil {
@Documented
@Retention(RetentionPolicy.SOURCE)
@StringDef({
EVENT_START,
EVENT_INPUT_FORMAT,
EVENT_OUTPUT_FORMAT,
EVENT_ACCEPTED_INPUT,
@ -83,6 +84,7 @@ public final class DebugTraceUtil {
@Target(TYPE_USE)
public @interface Event {}
public static final String EVENT_START = "Start";
public static final String EVENT_INPUT_FORMAT = "InputFormat";
public static final String EVENT_OUTPUT_FORMAT = "OutputFormat";
public static final String EVENT_ACCEPTED_INPUT = "AcceptedInput";
@ -107,6 +109,7 @@ public final class DebugTraceUtil {
@Documented
@Retention(RetentionPolicy.SOURCE)
@StringDef({
COMPONENT_TRANSFORMER_INTERNAL,
COMPONENT_ASSET_LOADER,
COMPONENT_AUDIO_DECODER,
COMPONENT_AUDIO_GRAPH,
@ -124,6 +127,7 @@ public final class DebugTraceUtil {
@Target(TYPE_USE)
public @interface Component {}
public static final String COMPONENT_TRANSFORMER_INTERNAL = "TransformerInternal";
public static final String COMPONENT_ASSET_LOADER = "AssetLoader";
public static final String COMPONENT_AUDIO_DECODER = "AudioDecoder";
public static final String COMPONENT_AUDIO_GRAPH = "AudioGraph";
@ -141,6 +145,7 @@ public final class DebugTraceUtil {
// For a given component, events are in the rough expected order that they occur.
private static final ImmutableMap<@Component String, List<@Event String>> COMPONENTS_TO_EVENTS =
ImmutableMap.<String, List<String>>builder()
.put(COMPONENT_TRANSFORMER_INTERNAL, ImmutableList.of(EVENT_START))
.put(COMPONENT_ASSET_LOADER, ImmutableList.of(EVENT_INPUT_FORMAT, EVENT_OUTPUT_FORMAT))
.put(
COMPONENT_AUDIO_DECODER,

View File

@ -21,6 +21,8 @@ import static androidx.media3.common.C.TRACK_TYPE_VIDEO;
import static androidx.media3.common.util.Assertions.checkArgument;
import static androidx.media3.common.util.Assertions.checkState;
import static androidx.media3.common.util.Util.contains;
import static androidx.media3.effect.DebugTraceUtil.COMPONENT_TRANSFORMER_INTERNAL;
import static androidx.media3.effect.DebugTraceUtil.EVENT_START;
import static androidx.media3.transformer.AssetLoader.SUPPORTED_OUTPUT_TYPE_DECODED;
import static androidx.media3.transformer.AssetLoader.SUPPORTED_OUTPUT_TYPE_ENCODED;
import static androidx.media3.transformer.Composition.HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC;
@ -62,6 +64,7 @@ import androidx.media3.common.util.Clock;
import androidx.media3.common.util.ConditionVariable;
import androidx.media3.common.util.HandlerWrapper;
import androidx.media3.common.util.Util;
import androidx.media3.effect.DebugTraceUtil;
import androidx.media3.muxer.Muxer.MuxerException;
import androidx.media3.transformer.AssetLoader.CompositionSettings;
import com.google.common.collect.ImmutableList;
@ -272,6 +275,12 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
progressState = Transformer.PROGRESS_STATE_WAITING_FOR_AVAILABILITY;
progressValue = 0;
}
DebugTraceUtil.logEvent(
COMPONENT_TRANSFORMER_INTERNAL,
EVENT_START,
/* presentationTimeUs= */ C.TIME_UNSET,
/* extraFormat= */ "%s",
/* extraArgs...= */ Util.DEVICE_DEBUG_INFO);
}
public @Transformer.ProgressState int getProgress(ProgressHolder progressHolder) {