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 { ...@@ -129,7 +129,7 @@ public interface FormatEvaluator {
public void evaluate(List<? extends MediaChunk> queue, long playbackPositionUs, public void evaluate(List<? extends MediaChunk> queue, long playbackPositionUs,
Format[] formats, Evaluation evaluation) { Format[] formats, Evaluation evaluation) {
Format newFormat = formats[random.nextInt(formats.length)]; 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.trigger = Chunk.TRIGGER_ADAPTIVE;
} }
evaluation.format = newFormat; evaluation.format = newFormat;
......
...@@ -304,7 +304,7 @@ public class DashChunkSource implements ChunkSource { ...@@ -304,7 +304,7 @@ public class DashChunkSource implements ChunkSource {
out.chunk = null; out.chunk = null;
return; return;
} else if (out.queueSize == queue.size() && out.chunk != null } 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 // We already have a chunk, and the evaluation hasn't changed either the format or the size
// of the queue. Leave unchanged. // of the queue. Leave unchanged.
return; return;
......
...@@ -587,7 +587,7 @@ public class HlsChunkSource { ...@@ -587,7 +587,7 @@ public class HlsChunkSource {
private int getVariantIndex(Format format) { private int getVariantIndex(Format format) {
for (int i = 0; i < variants.size(); i++) { for (int i = 0; i < variants.size(); i++) {
if (format == variants.get(i).format) { if (variants.get(i).format.equals(format)) {
return i; return i;
} }
} }
......
...@@ -248,7 +248,7 @@ public class SmoothStreamingChunkSource implements ChunkSource { ...@@ -248,7 +248,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
out.chunk = null; out.chunk = null;
return; return;
} else if (out.queueSize == queue.size() && out.chunk != null } 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 // We already have a chunk, and the evaluation hasn't changed either the format or the size
// of the queue. Do nothing. // of the queue. Do nothing.
return; return;
...@@ -352,7 +352,7 @@ public class SmoothStreamingChunkSource implements ChunkSource { ...@@ -352,7 +352,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
private int getTrackIndex(Format format) { private int getTrackIndex(Format format) {
TrackElement[] tracks = currentManifest.streamElements[streamElementIndex].tracks; TrackElement[] tracks = currentManifest.streamElements[streamElementIndex].tracks;
for (int i = 0; i < tracks.length; i++) { for (int i = 0; i < tracks.length; i++) {
if (format == tracks[i].format) { if (tracks[i].format.equals(format)) {
return i; 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