mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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.DrmInitData;
|
||||||
import com.google.android.exoplayer.drm.DrmSessionManager;
|
import com.google.android.exoplayer.drm.DrmSessionManager;
|
||||||
import com.google.android.exoplayer.util.Assertions;
|
import com.google.android.exoplayer.util.Assertions;
|
||||||
|
import com.google.android.exoplayer.util.TraceUtil;
|
||||||
import com.google.android.exoplayer.util.Util;
|
import com.google.android.exoplayer.util.Util;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
|
@ -362,9 +363,15 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
||||||
codecIsAdaptive = decoderInfo.adaptive;
|
codecIsAdaptive = decoderInfo.adaptive;
|
||||||
try {
|
try {
|
||||||
long codecInitializingTimestamp = SystemClock.elapsedRealtime();
|
long codecInitializingTimestamp = SystemClock.elapsedRealtime();
|
||||||
|
TraceUtil.beginSection("createByCodecName(" + decoderName + ")");
|
||||||
codec = MediaCodec.createByCodecName(decoderName);
|
codec = MediaCodec.createByCodecName(decoderName);
|
||||||
|
TraceUtil.endSection();
|
||||||
|
TraceUtil.beginSection("configureCodec");
|
||||||
configureCodec(codec, decoderName, format.getFrameworkMediaFormatV16(), mediaCrypto);
|
configureCodec(codec, decoderName, format.getFrameworkMediaFormatV16(), mediaCrypto);
|
||||||
|
TraceUtil.endSection();
|
||||||
|
TraceUtil.beginSection("codec.start()");
|
||||||
codec.start();
|
codec.start();
|
||||||
|
TraceUtil.endSection();
|
||||||
long codecInitializedTimestamp = SystemClock.elapsedRealtime();
|
long codecInitializedTimestamp = SystemClock.elapsedRealtime();
|
||||||
notifyDecoderInitialized(decoderName, codecInitializedTimestamp,
|
notifyDecoderInitialized(decoderName, codecInitializedTimestamp,
|
||||||
codecInitializedTimestamp - codecInitializingTimestamp);
|
codecInitializedTimestamp - codecInitializingTimestamp);
|
||||||
|
|
@ -499,10 +506,12 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
||||||
maybeInitCodec();
|
maybeInitCodec();
|
||||||
}
|
}
|
||||||
if (codec != null) {
|
if (codec != null) {
|
||||||
|
TraceUtil.beginSection("drainAndFeed");
|
||||||
while (drainOutputBuffer(positionUs, elapsedRealtimeUs)) {}
|
while (drainOutputBuffer(positionUs, elapsedRealtimeUs)) {}
|
||||||
if (feedInputBuffer(true)) {
|
if (feedInputBuffer(true)) {
|
||||||
while (feedInputBuffer(false)) {}
|
while (feedInputBuffer(false)) {}
|
||||||
}
|
}
|
||||||
|
TraceUtil.endSection();
|
||||||
}
|
}
|
||||||
codecCounters.ensureUpdated();
|
codecCounters.ensureUpdated();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.google.android.exoplayer.upstream;
|
package com.google.android.exoplayer.upstream;
|
||||||
|
|
||||||
import com.google.android.exoplayer.util.Assertions;
|
import com.google.android.exoplayer.util.Assertions;
|
||||||
|
import com.google.android.exoplayer.util.TraceUtil;
|
||||||
import com.google.android.exoplayer.util.Util;
|
import com.google.android.exoplayer.util.Util;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
@ -204,7 +205,9 @@ public final class Loader {
|
||||||
try {
|
try {
|
||||||
executorThread = Thread.currentThread();
|
executorThread = Thread.currentThread();
|
||||||
if (!loadable.isLoadCanceled()) {
|
if (!loadable.isLoadCanceled()) {
|
||||||
|
TraceUtil.beginSection(loadable.getClass().getSimpleName() + ".load()");
|
||||||
loadable.load();
|
loadable.load();
|
||||||
|
TraceUtil.endSection();
|
||||||
}
|
}
|
||||||
sendEmptyMessage(MSG_END_OF_SOURCE);
|
sendEmptyMessage(MSG_END_OF_SOURCE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue