Commit a63883a8 by Oliver Woodman

Fix format equality checking.

For Live SmoothStreaming, referential equality checking
isn't enough (it breaks once the manifest is updated).
Updated other instances too just for consistency.
parent 8eb73499
......@@ -129,7 +129,7 @@ public interface FormatEvaluator {
public void evaluate(List<? extends MediaChunk> queue, long playbackPositionUs,
Format[] formats, Evaluation evaluation) {
Format newFormat = formats[random.nextInt(formats.length)];
if (evaluation.format != null && !evaluation.format.id.equals(newFormat.id)) {
if (evaluation.format != null && !evaluation.format.equals(newFormat)) {
evaluation.trigger = Chunk.TRIGGER_ADAPTIVE;
}
evaluation.format = newFormat;
......
......@@ -304,7 +304,7 @@ public class DashChunkSource implements ChunkSource {
out.chunk = null;
return;
} else if (out.queueSize == queue.size() && out.chunk != null
&& out.chunk.format.id.equals(selectedFormat.id)) {
&& out.chunk.format.equals(selectedFormat)) {
// We already have a chunk, and the evaluation hasn't changed either the format or the size
// of the queue. Leave unchanged.
return;
......
......@@ -587,7 +587,7 @@ public class HlsChunkSource {
private int getVariantIndex(Format format) {
for (int i = 0; i < variants.size(); i++) {
if (format == variants.get(i).format) {
if (variants.get(i).format.equals(format)) {
return i;
}
}
......
......@@ -248,7 +248,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
out.chunk = null;
return;
} else if (out.queueSize == queue.size() && out.chunk != null
&& out.chunk.format.id.equals(evaluation.format.id)) {
&& out.chunk.format.equals(evaluation.format)) {
// We already have a chunk, and the evaluation hasn't changed either the format or the size
// of the queue. Do nothing.
return;
......@@ -352,7 +352,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
private int getTrackIndex(Format format) {
TrackElement[] tracks = currentManifest.streamElements[streamElementIndex].tracks;
for (int i = 0; i < tracks.length; i++) {
if (format == tracks[i].format) {
if (tracks[i].format.equals(format)) {
return i;
}
}
......
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