Skip to content

Commit

Permalink
Complete delta-playlist merging and playlist alignment
Browse files Browse the repository at this point in the history
- Do not adjustSliding twice with delta playlist
- Add LevelDetail adjustedSliding distinguished from PTSKnown (+5 squashed commits)
- Align streams without DISCONTINUITY, PROGRAM-DATE-TIME, or known-PTS on SEQUENCE-NUMBER to improve first fragment requested
- Fix delta playlist merging without fragment PTS (adjustSliding with skipped segments)
- Fix playlist sliding check
- Sync levels on PTS by setting transmuxer defaultInitPTS
Add playbackRate controls to demo
- Add lowLatencyMode config (doesn't yet disable part playlist loading)
- Add SKIP delta playlist tag to README
  • Loading branch information
Rob Walch committed Oct 2, 2020
1 parent 2c00055 commit 1cb049d
Show file tree
Hide file tree
Showing 35 changed files with 558 additions and 422 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ module.exports = {
'files': ['*.ts'],
'rules': {
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 1,
'@typescript-eslint/no-unused-vars': [ 'error', { 'args': 'none' } ],
'@typescript-eslint/prefer-optional-chain': 2,
'@typescript-eslint/consistent-type-assertions': [ 2,
{
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ Playlist tags
- `#EXT-X-PART-INF:PART-TARGET=<n>`
- `#EXT-X-PART:<attribute-list>`
- `#EXT-X-PRELOAD-HINT:<attribute-list>`
- `#EXT-X-SKIP:<attribute-list>`
- `#EXT-X-RENDITION-REPORT:<attribute-list>`
- The following tags are added to their respective fragment's attribute list
- `#EXT-X-DATERANGE:<attribute-list>`
Expand Down
30 changes: 23 additions & 7 deletions demo/chart/chartjs-horizontal-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ Chart.controllers.horizontalBar.prototype.calculateBarValuePixels = function (da
const chart = this.chart;
const scale = this._getValueScale();
const datasets = chart.data.datasets;
if (!datasets) {
throw new Error(`Chart datasets are ${datasets}`);
}
scale._parseValue = scaleParseValue;
const value = scale._parseValue(datasets[datasetIndex].data[index]);
const obj = datasets[datasetIndex].data[index];
if (obj.dataType === 'part') {
console.assert(obj.start === obj.fragment.start + obj.fragOffset);
}
const value = scale._parseValue(obj);
const start = value.start === undefined ? 0 : value.max >= 0 && value.min >= 0 ? value.min : value.max;
const length = value.start === undefined ? value.end : value.max >= 0 && value.min >= 0 ? value.max - value.min : value.min - value.max;
const base = scale.getPixelForValue(start);
Expand Down Expand Up @@ -64,13 +71,17 @@ Chart.controllers.horizontalBar.prototype.draw = function () {
if (!isNaN(val.min) && !isNaN(val.max)) {
const { dataType } = obj;
let { stats } = obj;
const isFragment = dataType === 'fragment';
const isPart = dataType === 'part';
const isFragmentHint = dataType === 'fragmentHint';
const isFragment = dataType === 'fragment' || isPart || isFragmentHint;
const isCue = dataType === 'cue';
if (isCue) {
view.y += (view.height * 0.5 * (i % 2)) - (view.height * 0.25);
} else if (isPart) {
view.height -= 22;
}
const bounds = boundingRects(view);
const drawText = bounds.w > lineHeight;
const drawText = bounds.w > lineHeight * 1.5 && !isFragmentHint;
if (isFragment || isCue) {
if (drawText) {
view.borderWidth = 1;
Expand All @@ -83,7 +94,12 @@ Chart.controllers.horizontalBar.prototype.draw = function () {
view.borderWidth = 0;
}
}
view.backgroundColor = `rgba(0, 0, 0, ${0.05 + (i % 2) / 12})`;
if (isFragmentHint) {
view.borderWidth = 0;
view.backgroundColor = 'rgba(0, 0, 0, 0.1)';
} else {
view.backgroundColor = `rgba(0, 0, 0, ${0.05 + (i % 2) / 12})`;
}
}
rect.draw();
if (isFragment) {
Expand Down Expand Up @@ -118,14 +134,14 @@ Chart.controllers.horizontalBar.prototype.draw = function () {
snBounds.w -= ccWidth;
}
}
const snLabel = `sn: ${obj.sn}`;
const snLabel = isPart ? `part: ${obj.index}` : `sn: ${obj.sn}`;
const textWidth = Math.min(ctx.measureText(snLabel).width + 2, snBounds.w - 2);
ctx.fillText(snLabel, snBounds.x + snBounds.w - textWidth, snBounds.y + lineHeight, snBounds.w - 4);
}
if (isCue) {
const strLength = Math.min(30, Math.ceil(bounds.w / (lineHeight / 3)));
ctx.fillText(('' + obj.content).substr(0, strLength), bounds.x + 2, bounds.y + bounds.h - 3, bounds.w - 5);
} else {
} else if (!isPart) {
const float = start !== (start | 0);
const fixedDigits = float ? Math.min(5, Math.max(1, Math.floor(bounds.w / 10 - 1))) : 0;
const startString = hhmmss(start, fixedDigits);
Expand All @@ -140,7 +156,7 @@ Chart.controllers.horizontalBar.prototype.draw = function () {

export function applyChartInstanceOverrides (chart) {
Object.keys(chart.scales).forEach((axis) => {
const scale = chart.scales[axis];
const scale = chart.scales![axis];
scale._parseValue = scaleParseValue;
});
}
Expand Down
Loading

0 comments on commit 1cb049d

Please sign in to comment.