1.5.1 currentPendingRequests removal doesn't remove all requests and breaks seeking
Created by: JibberJim
1.5.1 has various seeking bugs, one of them is related to the removal of cancelled requests being broken due to pendingRequests not being correctly removed in FragmentModel.js, as the reqs/cancelled is copied by reference, this code shows the issue:
function test(quality) {
var reqs = pendingRequests,
canceled = reqs;
pendingRequests = [];
if (quality !== undefined) {
pendingRequests = reqs.filter(function(request) {
if (request.quality === quality) {
return false;
}
canceled.splice(canceled.indexOf(request), 1);
return true;
});
}
alert(JSON.stringify(pendingRequests)+"\n\n"+JSON.stringify(canceled));
}
var pendingRequests=[{quality:1},{quality:2},{quality:3},{quality:4},{quality:1},{quality:2},{quality:3},{quality:4}];
test(1);
The result is seeking is broken sometimes when seeking into pending requests.