Skip to content

Commit

Permalink
move logic from binary search into comparison function
Browse files Browse the repository at this point in the history
  • Loading branch information
gjanblaszczyk committed May 11, 2016
1 parent b460aed commit 270f4b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/stream-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class StreamController extends EventHandler {
if ((candidate.start + candidate.duration - maxFragLookUpTolerance) <= bufferEnd) {
return 1;
}
else if (candidate.start - maxFragLookUpTolerance > bufferEnd) {
else if (candidate.start - maxFragLookUpTolerance > bufferEnd && candidate.start) {
return -1;
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/binary-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var BinarySearch = {
if (comparisonResult > 0) {
minIndex = currentIndex + 1;
}
else if (comparisonResult < 0 && currentIndex) {
else if (comparisonResult < 0) {
maxIndex = currentIndex - 1;
}
else {
Expand Down

0 comments on commit 270f4b4

Please sign in to comment.