Commit 7760eca2 by olly Committed by Oliver Woodman

Deep compare formats in SampleMetadataQueue instead of shallow compare

PiperOrigin-RevId: 258285645
parent 2b5c42e0
...@@ -227,7 +227,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -227,7 +227,7 @@ import com.google.android.exoplayer2.util.Util;
return SampleQueue.PEEK_RESULT_NOTHING; return SampleQueue.PEEK_RESULT_NOTHING;
} }
int relativeReadIndex = getRelativeIndex(readPosition); int relativeReadIndex = getRelativeIndex(readPosition);
if (formats[relativeReadIndex] != downstreamFormat) { if (formats[relativeReadIndex].equals(downstreamFormat)) {
return SampleQueue.PEEK_RESULT_FORMAT; return SampleQueue.PEEK_RESULT_FORMAT;
} else { } else {
return (flags[relativeReadIndex] & C.BUFFER_FLAG_ENCRYPTED) != 0 return (flags[relativeReadIndex] & C.BUFFER_FLAG_ENCRYPTED) != 0
...@@ -275,7 +275,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -275,7 +275,7 @@ import com.google.android.exoplayer2.util.Util;
buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM); buffer.setFlags(C.BUFFER_FLAG_END_OF_STREAM);
return C.RESULT_BUFFER_READ; return C.RESULT_BUFFER_READ;
} else if (upstreamFormat != null } else if (upstreamFormat != null
&& (formatRequired || upstreamFormat != downstreamFormat)) { && (formatRequired || !upstreamFormat.equals(downstreamFormat))) {
formatHolder.format = upstreamFormat; formatHolder.format = upstreamFormat;
return C.RESULT_FORMAT_READ; return C.RESULT_FORMAT_READ;
} else { } else {
...@@ -284,7 +284,7 @@ import com.google.android.exoplayer2.util.Util; ...@@ -284,7 +284,7 @@ import com.google.android.exoplayer2.util.Util;
} }
int relativeReadIndex = getRelativeIndex(readPosition); int relativeReadIndex = getRelativeIndex(readPosition);
if (formatRequired || formats[relativeReadIndex] != downstreamFormat) { if (formatRequired || !formats[relativeReadIndex].equals(downstreamFormat)) {
formatHolder.format = formats[relativeReadIndex]; formatHolder.format = formats[relativeReadIndex];
return C.RESULT_FORMAT_READ; return C.RESULT_FORMAT_READ;
} }
...@@ -422,7 +422,6 @@ import com.google.android.exoplayer2.util.Util; ...@@ -422,7 +422,6 @@ import com.google.android.exoplayer2.util.Util;
} }
upstreamFormatRequired = false; upstreamFormatRequired = false;
if (Util.areEqual(format, upstreamFormat)) { if (Util.areEqual(format, upstreamFormat)) {
// Suppress changes between equal formats so we can use referential equality in readData.
return false; return false;
} else { } else {
upstreamFormat = format; upstreamFormat = format;
......
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