Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 38x 38x 38x 38x 38x 38x 38x 1x 1x | import FactoryMaker from '../../core/FactoryMaker.js';
function DroppedFramesHistory() {
let values = {};
let lastDroppedFrames = {};
let lastTotalFrames = {};
function push(streamId, representationId, playbackQuality) {
if (!representationId) {
return;
}
if (!values[streamId]) {
_initializeForStream(streamId);
}
let droppedVideoFrames = playbackQuality && playbackQuality.droppedVideoFrames ? playbackQuality.droppedVideoFrames : 0;
let totalVideoFrames = playbackQuality && playbackQuality.totalVideoFrames ? playbackQuality.totalVideoFrames : 0;
let intervalDroppedFrames = droppedVideoFrames - lastDroppedFrames[streamId];
lastDroppedFrames[streamId] = droppedVideoFrames;
let intervalTotalFrames = totalVideoFrames - lastTotalFrames[streamId];
lastTotalFrames[streamId] = totalVideoFrames;
const current = values[streamId];
if (!current[representationId]) {
current[representationId] = {
droppedVideoFrames: intervalDroppedFrames,
totalVideoFrames: intervalTotalFrames
};
} else {
current[representationId].droppedVideoFrames += intervalDroppedFrames;
current[representationId].totalVideoFrames += intervalTotalFrames;
}
}
function _initializeForStream(streamId) {
values[streamId] = [];
lastDroppedFrames[streamId] = 0;
lastTotalFrames[streamId] = 0;
}
function getFrameHistory(streamId) {
return values[streamId];
}
function clearForStream(streamId) {
delete values[streamId];
delete lastDroppedFrames[streamId];
delete lastTotalFrames[streamId];
}
function reset() {
values = {};
lastDroppedFrames = {};
lastTotalFrames = {};
}
return {
clearForStream,
getFrameHistory,
push,
reset
};
}
DroppedFramesHistory.__dashjs_factory_name = 'DroppedFramesHistory';
const factory = FactoryMaker.getClassFactory(DroppedFramesHistory);
export default factory;
|