Only log first input reader length

It's not feasible to reliably differentiate a different
segment parsing from a seek.

Bug: 158742256
Test: atest CtsMediaParserTestCases
Test: atest CtsMediaParserHostTestCases
Change-Id: I7d62f1c2b9334bf601f38ce915b0fafdc76fbec1
Merged-In: I7d62f1c2b9334bf601f38ce915b0fafdc76fbec1
(cherry picked from commit 2eee34d286)
This commit is contained in:
Santiago Seifert
2020-11-05 16:35:00 +00:00
parent e945dc22c0
commit 35a129e8ac

View File

@@ -1186,11 +1186,10 @@ public final class MediaParser {
// TODO: For efficiency, the same implementation should be used, by providing a // TODO: For efficiency, the same implementation should be used, by providing a
// clearBuffers() method, or similar. // clearBuffers() method, or similar.
long resourceLength = seekableInputReader.getLength(); long resourceLength = seekableInputReader.getLength();
if (resourceLength == -1) { if (mResourceByteCount == 0) {
mResourceByteCount = -1; // For resource byte count metric collection, we only take into account the length
} // of the first provided input reader.
if (mResourceByteCount != -1) { mResourceByteCount = resourceLength;
mResourceByteCount += resourceLength;
} }
mExtractorInput = mExtractorInput =
new DefaultExtractorInput( new DefaultExtractorInput(