mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Log DebugTraceUtil events to logcat as they occur.
PiperOrigin-RevId: 633512813
This commit is contained in:
parent
b182e469f6
commit
95c13819af
1 changed files with 18 additions and 2 deletions
|
|
@ -25,6 +25,7 @@ import androidx.annotation.GuardedBy;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringDef;
|
import androidx.annotation.StringDef;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
|
import androidx.media3.common.util.Log;
|
||||||
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;
|
||||||
|
|
@ -50,11 +51,22 @@ public final class DebugTraceUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to store tracing events for debug logging. Should be set to {@code true} for testing
|
* Whether to store tracing events for debug logging. Should be set to {@code true} for testing
|
||||||
* and debugging purposes only, before running transformer.
|
* and debugging purposes only.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("NonFinalStaticField") // Only for debugging/testing.
|
@SuppressWarnings("NonFinalStaticField") // Only for debugging/testing.
|
||||||
public static boolean enableTracing = false;
|
public static boolean enableTracing = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to {@linkplain Log#d(String, String) log} tracing events to the logcat as they occur.
|
||||||
|
* Should be set to {@code true} for testing and debugging purposes only.
|
||||||
|
*
|
||||||
|
* <p>Note that enabling this can add a large amount of logcat lines.
|
||||||
|
*
|
||||||
|
* <p>Requires {@link #enableTracing} to be true.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("NonFinalStaticField") // Only for debugging/testing.
|
||||||
|
public static boolean enableTracesInLogcat = false;
|
||||||
|
|
||||||
/** Events logged by {@link #logEvent}. */
|
/** Events logged by {@link #logEvent}. */
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
|
@ -256,7 +268,11 @@ public final class DebugTraceUtil {
|
||||||
}
|
}
|
||||||
EventLogger logger = events.get(event);
|
EventLogger logger = events.get(event);
|
||||||
String extra = Util.formatInvariant(extraFormat, extraArgs);
|
String extra = Util.formatInvariant(extraFormat, extraArgs);
|
||||||
logger.addLog(new EventLog(presentationTimeUs, eventTimeMs, extra));
|
EventLog eventLog = new EventLog(presentationTimeUs, eventTimeMs, extra);
|
||||||
|
logger.addLog(eventLog);
|
||||||
|
if (enableTracesInLogcat) {
|
||||||
|
Log.d("DebugTrace-" + component, event + ": " + eventLog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue