Commit bc731024 by andrewlewis Committed by Ian Baker

Suppress repeated logging for invalid MP3 headers

PiperOrigin-RevId: 315243493
parent 680d9558
......@@ -34,7 +34,7 @@ import com.google.android.exoplayer2.util.Log;
private long processedSamples;
private long anchorTimestampUs;
private boolean audioHeaderInvalid;
private boolean seenInvalidMpegAudioHeader;
/**
* Resets the timestamp tracker.
......@@ -44,7 +44,7 @@ import com.google.android.exoplayer2.util.Log;
public void reset() {
processedSamples = 0;
anchorTimestampUs = 0;
audioHeaderInvalid = false;
seenInvalidMpegAudioHeader = false;
}
/**
......@@ -55,7 +55,7 @@ import com.google.android.exoplayer2.util.Log;
* @return The expected output presentation time, in microseconds.
*/
public long updateAndGetPresentationTimeUs(Format format, DecoderInputBuffer buffer) {
if (audioHeaderInvalid || buffer.data == null) {
if (seenInvalidMpegAudioHeader || buffer.data == null) {
return buffer.timeUs;
}
......@@ -70,6 +70,7 @@ import com.google.android.exoplayer2.util.Log;
int frameCount = MpegAudioUtil.parseMpegAudioFrameSampleCount(sampleHeaderData);
if (frameCount == C.LENGTH_UNSET) {
seenInvalidMpegAudioHeader = true;
Log.w(TAG, "MPEG audio header is invalid.");
return buffer.timeUs;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment