mirror of
https://github.com/samsonjs/media.git
synced 2026-04-08 11:45:51 +00:00
Add some useful Systrace
This commit is contained in:
parent
96c1e670c4
commit
926bc805f5
2 changed files with 12 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ import com.google.android.exoplayer.MediaCodecUtil.DecoderQueryException;
|
|||
import com.google.android.exoplayer.drm.DrmInitData;
|
||||
import com.google.android.exoplayer.drm.DrmSessionManager;
|
||||
import com.google.android.exoplayer.util.Assertions;
|
||||
import com.google.android.exoplayer.util.TraceUtil;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
|
|
@ -362,9 +363,15 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
|||
codecIsAdaptive = decoderInfo.adaptive;
|
||||
try {
|
||||
long codecInitializingTimestamp = SystemClock.elapsedRealtime();
|
||||
TraceUtil.beginSection("createByCodecName(" + decoderName + ")");
|
||||
codec = MediaCodec.createByCodecName(decoderName);
|
||||
TraceUtil.endSection();
|
||||
TraceUtil.beginSection("configureCodec");
|
||||
configureCodec(codec, decoderName, format.getFrameworkMediaFormatV16(), mediaCrypto);
|
||||
TraceUtil.endSection();
|
||||
TraceUtil.beginSection("codec.start()");
|
||||
codec.start();
|
||||
TraceUtil.endSection();
|
||||
long codecInitializedTimestamp = SystemClock.elapsedRealtime();
|
||||
notifyDecoderInitialized(decoderName, codecInitializedTimestamp,
|
||||
codecInitializedTimestamp - codecInitializingTimestamp);
|
||||
|
|
@ -499,10 +506,12 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
|||
maybeInitCodec();
|
||||
}
|
||||
if (codec != null) {
|
||||
TraceUtil.beginSection("drainAndFeed");
|
||||
while (drainOutputBuffer(positionUs, elapsedRealtimeUs)) {}
|
||||
if (feedInputBuffer(true)) {
|
||||
while (feedInputBuffer(false)) {}
|
||||
}
|
||||
TraceUtil.endSection();
|
||||
}
|
||||
codecCounters.ensureUpdated();
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
package com.google.android.exoplayer.upstream;
|
||||
|
||||
import com.google.android.exoplayer.util.Assertions;
|
||||
import com.google.android.exoplayer.util.TraceUtil;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
|
@ -204,7 +205,9 @@ public final class Loader {
|
|||
try {
|
||||
executorThread = Thread.currentThread();
|
||||
if (!loadable.isLoadCanceled()) {
|
||||
TraceUtil.beginSection(loadable.getClass().getSimpleName() + ".load()");
|
||||
loadable.load();
|
||||
TraceUtil.endSection();
|
||||
}
|
||||
sendEmptyMessage(MSG_END_OF_SOURCE);
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue