Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Representation bandwidth based cache Response detection timeout #4546

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/streaming/models/MetricsModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ function MetricsModel(config) {
vo._fileLoaderType = request.fileLoaderType;
vo._resourceTimingValues = request.resourceTimingValues;
vo._streamId = request && request.representation && request.representation.mediaInfo && request.representation.mediaInfo.streamInfo ? request.representation.mediaInfo.streamInfo.id : null;
vo._bandwidthRatio = request && request.bandwidth && request.representation && request.representation.mediaInfo ? request.representation.mediaInfo.bitrateList[request.representation.mediaInfo.bitrateList.length - 1].bandwidth / request.bandwidth : 1;

if (traces) {
traces.forEach(trace => {
Expand Down
2 changes: 1 addition & 1 deletion src/streaming/models/ThroughputModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function ThroughputModel(config) {
}
}

const cacheReferenceTime = (httpRequest._tfinish.getTime() - httpRequest.trequest.getTime());
const cacheReferenceTime = (httpRequest._tfinish.getTime() - httpRequest.trequest.getTime()) * httpRequest._bandwidthRatio;

if (_isCachedResponse(mediaType, cacheReferenceTime, httpRequest)) {
logger.debug(`${mediaType} Assuming segment ${httpRequest.url} came from cache, ignoring it for throughput calculation`);
Expand Down
4 changes: 4 additions & 0 deletions src/streaming/vo/metrics/HTTPRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ class HTTPRequest {
* The values derived from the ResourceTimingAPI.
*/
this._resourceTimingValues = null;
/**
* The ratio of the current representation bandwidth to the top representation bandwidth - used for adjusting cachedetection to bitrate ladder.
*/
this._bandwidthRatio = 1;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('ThroughputModel', () => {
}
})
dummyHttpRequest._tfinish = dummyHttpRequest.trequest;
dummyHttpRequest._bandwidthRatio = 1;
throughputModel.addEntry('video', dummyHttpRequest);
const values = throughputModel.getThroughputDict('video');

Expand Down