Use Dumper.addTime in more places

This ensures that `C.TIME_UNSET` is more clear in dump files. Some of
these call-sites will **never** pass `C.TIME_UNSET`, but it seems
clearest to always use `addTime` and maybe it will ensure when these
sites are copied in future, `addTime` will be used in the new location
too.

PiperOrigin-RevId: 628363183
This commit is contained in:
ibaker 2024-04-26 04:18:24 -07:00 committed by Copybara-Service
parent e194225b32
commit 5666678d8a
6 changed files with 8 additions and 8 deletions

View File

@ -154,7 +154,7 @@ public final class CapturingAudioSink extends ForwardingAudioSink implements Dum
public void dump(Dumper dumper) {
dumper
.startBlock("buffer #" + bufferCounter)
.add("time", presentationTimeUs)
.addTime("time", presentationTimeUs)
.add("data", dataHashcode)
.endBlock();
}

View File

@ -51,7 +51,7 @@ public final class CapturingImageOutput implements Dumpable, ImageOutput {
renderedBitmaps.add(
dumper -> {
dumper.startBlock("image output #" + currentImageCount);
dumper.add("presentationTimeUs", presentationTimeUs);
dumper.addTime("presentationTimeUs", presentationTimeUs);
dumper.add("bitmap hash", Arrays.hashCode(bitmapPixels));
dumper.endBlock();
});

View File

@ -421,7 +421,7 @@ public class CapturingRenderersFactory implements RenderersFactory, Dumper.Dumpa
@Override
public void dump(Dumper dumper) {
dumper.startBlock("input buffer #" + inputBufferCounter);
dumper.add("timeUs", bufferTimeUs);
dumper.addTime("timeUs", bufferTimeUs);
if (flags != 0) {
dumper.add("flags", flags);
}
@ -450,7 +450,7 @@ public class CapturingRenderersFactory implements RenderersFactory, Dumper.Dumpa
@Override
public void dump(Dumper dumper) {
dumper.startBlock("output buffer #" + outputBufferCounter);
dumper.add("timeUs", bufferTimeUs);
dumper.addTime("timeUs", bufferTimeUs);
if (flags != 0) {
dumper.add("flags", flags);
}

View File

@ -245,7 +245,7 @@ public final class FakeTrackOutput implements TrackOutput, Dumper.Dumpable {
public void dump(Dumper dumper) {
dumper
.startBlock("sample " + index)
.add("time", timeUs)
.addTime("time", timeUs)
.add("flags", flags)
.add("data", getSampleData(startOffset, endOffset));
if (cryptoData != null) {

View File

@ -139,7 +139,7 @@ public final class PlaybackOutput implements Dumper.Dumpable {
for (int i = 0; i < metadatas.size(); i++) {
dumper.startBlock("Metadata[" + i + "]");
Metadata metadata = metadatas.get(i);
dumper.add("presentationTimeUs", metadata.presentationTimeUs);
dumper.addTime("presentationTimeUs", metadata.presentationTimeUs);
for (int j = 0; j < metadata.length(); j++) {
dumper.add("entry[" + j + "]", getEntryAsString(metadata.get(j)));
}
@ -387,7 +387,7 @@ public final class PlaybackOutput implements Dumper.Dumpable {
dumper.startBlock("Subtitle[" + i + "]");
// TODO: Solving https://github.com/google/ExoPlayer/issues/9672 will allow us to remove this
// hack of forcing presentationTimeUs to be >= 0.
dumper.add("presentationTimeUs", max(0, subtitles.get(i).presentationTimeUs));
dumper.addTime("presentationTimeUs", max(0, subtitles.get(i).presentationTimeUs));
ImmutableList<Cue> subtitle = subtitles.get(i).cues;
if (!subtitle.equals(subtitlesFromDeprecatedTextOutput.get(i))) {
throw new IllegalStateException(

View File

@ -280,7 +280,7 @@ public final class CapturingMuxer implements Muxer, Dumpable {
.add("size", sampleSize)
.add("isKeyFrame", isKeyFrame);
if (presentationTimeUs != C.TIME_UNSET) {
dumper.add("presentationTimeUs", presentationTimeUs);
dumper.addTime("presentationTimeUs", presentationTimeUs);
}
dumper.endBlock();
}