Skip to content

Commit

Permalink
Merge branch 'feature/v1.0.0' into LHLS
Browse files Browse the repository at this point in the history
* feature/v1.0.0: (96 commits)
  Fix audio gaps introduced by changes in remuxer continuity tracking
  Enforce no-case-declarations
  Cleanup timeout calls
  Enforce 'no-unused-vars' lint rule
  Update package-lock
  Update TypeScript and run `npm audit fix`
  Add a lint rule to disallow use of SourceBuffer global
  Fix `isSupported` check in browser missing `SourceBuffer` global Fixes video-dev#2430 video-dev#2476
  https
  add code of conduct
  Remove build:types from release job.
  Remove TypeScript types build step
  only include js files in release
  Prevent seeking to 0 when startPosition is -1 Fixes video-dev#2438
  Prevent RangeError exception when parsing incomplete PES Fixes video-dev#2415 Relates to video-dev#2109
  Log license key size (DRM functional test troubleshooting)
  Improve functional test assertion feedback
  Handle stalls when seeking into buffer gaps
  Update gap controller to observe buffer gaps regardless of max buffer hole
  Update gap-controller comments
  ...
  • Loading branch information
Rob Walch committed Jan 9, 2020
2 parents dd17a46 + 8bffb8e commit a8f1a7e
Show file tree
Hide file tree
Showing 26 changed files with 273 additions and 169 deletions.
18 changes: 15 additions & 3 deletions .eslintrc.js
Expand Up @@ -77,6 +77,18 @@ module.exports = {
{
'name': 'window',
'message': 'Use `self` instead of `window` to access the global context everywhere (including workers).'
},
{
'name': 'SourceBuffer',
'message': 'Use `self.SourceBuffer`'
},
{
'name': 'setTimeout',
'message': 'Use `self.setTimeout`'
},
{
'name': 'setInterval',
'message': 'Use `self.setInterval`'
}
],

Expand All @@ -93,11 +105,11 @@ module.exports = {
'no-var': 1,
'no-empty': 1,
'no-mixed-operators': 1,
'no-unused-vars': 1,
'no-unused-vars': 2,
'@typescript-eslint/no-unused-vars': 1,
'no-console': 1,
'no-fallthrough': 1,
'no-case-declarations': 1,
'no-case-declarations': 2,
'no-irregular-whitespace': 1,
'no-self-assign': 1,
'new-cap': 1,
Expand All @@ -111,7 +123,7 @@ module.exports = {
'no-useless-catch': 2,
'lines-between-class-members': 2,
'no-prototype-builtins': 0,
'@typescript-eslint/consistent-type-assertions': [ 2,
'@typescript-eslint/consistent-type-assertions': [ 2,
{
'assertionStyle': 'as',
'objectLiteralTypeAssertions': 'never'
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -32,7 +32,7 @@ jobs:
api_key:
secure: "kR9xHKhWfOv6vwxz1d//PpC22VDupnPI59L9czLkpLoIdzm5rm3eV7he4XPlQfbSrV1UBgURARgF+yekmeqUZk9vqfo4F5oa+6KiBxAdnI9PjsjYRSXitdq4a6kpIR854nxUIOlDXR5AbD2MgNaKsQHiaNlngdR/870OhiwqRJVwQOLKVUADw1QWECXe/DXrQiFbMunxBrTyutbrGuI8cT7wzqFn+aPkI/3liiw8PTr93GrtxZ/bFxI899KzMSHHMXB+eDDMtxPFD+VApruD7h6f+1C0psJeOV8/PkzrRkbPELPBKKaPH9TvVOPUf2OSRHVna828wnLHwseae0rgtuk7+ZJmB9XZKX9FUBDT4/Gv/AkE+m/cwnoqaatAMJYR+yiQqsosjBLDAaTUOPHu3wBdAaR5uL5fGsSsKe3sUfSQHrv86vReNl9ETU06apmyWtsIbyhMtv98j9I+hNVjKZUI30g1ee6LgjlDlBavMk8KAbLbyBTcJlNAexj8Rppdqg+AdW7rYW+S6SgfTyyYQKTLeFwmDjfrkqzHJnk78sV18+xPLI1hbzBGp/bXaW23sLDBLLV5Sxifr8flUMkUdH28zsLCHUQ7C4GKQ19el2NZgIxSsnxRA8vGZof7OXasR4HJVjv/PSx+DN6Fi1PV1SiNBcwgPCGIIxBF7TUPxJk="
file_glob: true
file: dist/*
file: dist/*.{js,js.map}
draft: true
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
Expand Down
84 changes: 84 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,84 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at the [video-dev slack](https://video-dev.org/). All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the project community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
47 changes: 44 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -92,7 +92,8 @@
"selenium-webdriver": "^3.1.0",
"sinon": "7.1.1",
"sinon-chai": "3.3.0",
"typescript": "^3.6.3",
"typescript": "^3.7.4",
"typescript-eslint-parser": "^21.0.2",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.4",
Expand Down
7 changes: 3 additions & 4 deletions scripts/travis.sh
Expand Up @@ -12,7 +12,7 @@ if [ "${TRAVIS_MODE}" = "build" ]; then
echo "travis_fold:end:lint"
echo "travis_fold:start:build"
npm run type-check
npm run build
npm run build:ci
npm run build:types
echo "travis_fold:end:build"
echo "travis_fold:start:docs"
Expand All @@ -24,7 +24,7 @@ if [ "${TRAVIS_MODE}" = "build" ]; then
elif [ "${TRAVIS_MODE}" = "unitTests" ]; then
npm run test:unit
elif [ "${TRAVIS_MODE}" = "funcTests" ]; then
npm run build
npm run build:ci
n=0
maxRetries=1
until [ $n -ge ${maxRetries} ]
Expand All @@ -50,8 +50,7 @@ elif [ "${TRAVIS_MODE}" = "release" ] || [ "${TRAVIS_MODE}" = "releaseCanary" ]
node ./scripts/set-package-version.js
npm run lint
npm run type-check
npm run build
npm run build:types
npm run build:ci

if [ "${TRAVIS_MODE}" != "netlifyPr" ]; then
npm run test:unit
Expand Down
2 changes: 1 addition & 1 deletion src/controller/abr-controller.ts
Expand Up @@ -50,7 +50,7 @@ class AbrController extends EventHandler {
if (frag.type === 'main') {
if (!this.timer) {
this.fragCurrent = frag;
this.timer = setInterval(this.onCheck, 100);
this.timer = self.setInterval(this.onCheck, 100);
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/controller/audio-stream-controller.ts
Expand Up @@ -112,7 +112,7 @@ class AudioStreamController extends BaseStreamController {
}
break;
}
case State.FRAG_LOADING_WAITING_RETRY:
case State.FRAG_LOADING_WAITING_RETRY: {
const now = performance.now();
const retryDate = this.retryDate;
const isSeeking = media && media.seeking;
Expand All @@ -122,7 +122,8 @@ class AudioStreamController extends BaseStreamController {
this.state = State.IDLE;
}
break;
case State.WAITING_INIT_PTS:
}
case State.WAITING_INIT_PTS: {
const videoTrackCC = this.videoTrackCC;
if (Number.isFinite(this.initPTS[videoTrackCC])) {
// Ensure we don't get stuck in the WAITING_INIT_PTS state if the waiting frag CC doesn't match any initPTS
Expand All @@ -145,6 +146,7 @@ class AudioStreamController extends BaseStreamController {
}
}
break;
}
default:
break;
}
Expand Down Expand Up @@ -448,7 +450,7 @@ class AudioStreamController extends BaseStreamController {

switch (data.details) {
case ErrorDetails.FRAG_LOAD_ERROR:
case ErrorDetails.FRAG_LOAD_TIMEOUT:
case ErrorDetails.FRAG_LOAD_TIMEOUT: {
const frag = data.frag;
// don't handle frag error not related to audio fragment
if (frag && frag.type !== 'audio') {
Expand Down Expand Up @@ -480,6 +482,7 @@ class AudioStreamController extends BaseStreamController {
}
}
break;
}
case ErrorDetails.AUDIO_TRACK_LOAD_ERROR:
case ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:
case ErrorDetails.KEY_LOAD_ERROR:
Expand Down
2 changes: 1 addition & 1 deletion src/controller/fps-controller.js
Expand Up @@ -30,7 +30,7 @@ class FPSController extends EventHandler {
}

clearInterval(this.timer);
this.timer = setInterval(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);
this.timer = self.setTimeout(this.checkFPSInterval.bind(this), config.fpsDroppedMonitoringPeriod);
}
}

Expand Down
Empty file.
19 changes: 11 additions & 8 deletions src/controller/level-helper.ts
Expand Up @@ -34,16 +34,19 @@ export function updatePTS (fragments: Fragment[], fromIdx: number, toIdx: number
if (Number.isFinite(fragToPTS)) {
// update fragment duration.
// it helps to fix drifts between playlist reported duration and fragment real duration
let duration: number = 0;
let frag: Fragment;
if (toIdx > fromIdx) {
fragFrom.duration = fragToPTS - fragFrom.start;
if (fragFrom.duration < 0) {
logger.warn(`negative duration computed for frag ${fragFrom.sn},level ${fragFrom.level}, there should be some duration drift between playlist and fragment!`);
}
duration = fragToPTS - fragFrom.start;
frag = fragFrom;
} else {
fragTo.duration = fragFrom.start - fragToPTS;
if (fragTo.duration < 0) {
logger.warn(`negative duration computed for frag ${fragTo.sn},level ${fragTo.level}, there should be some duration drift between playlist and fragment!`);
}
duration = fragFrom.start - fragToPTS;
frag = fragTo;
}
console.assert(duration > 0,
`duration of ${duration} computed for frag ${frag.sn}, level ${frag.level}, there should be some duration drift between playlist and fragment!`);
if (frag.duration !== duration) {
frag.duration = duration;
}
} else {
// we dont know startPTS[toIdx]
Expand Down
4 changes: 2 additions & 2 deletions src/controller/stream-controller.ts
Expand Up @@ -338,10 +338,10 @@ export default class StreamController extends BaseStreamController {
let fetchdelay;
let nextBufferedFrag;
const fragPlayingCurrent = this.getAppendedFrag(media.currentTime);
if (fragPlayingCurrent && fragPlayingCurrent.startPTS > 1) {
if (fragPlayingCurrent && fragPlayingCurrent.start > 1) {
// flush buffer preceding current fragment (flush until current fragment start offset)
// minus 1s to avoid video freezing, that could happen if we flush keyframe of current video ...
this.flushMainBuffer(0, fragPlayingCurrent.startPTS - 1);
this.flushMainBuffer(0, fragPlayingCurrent.start - 1);
}
if (!media.paused && levels) {
// add a safety delay of 1s
Expand Down
2 changes: 1 addition & 1 deletion src/controller/timeline-controller.ts
Expand Up @@ -327,7 +327,7 @@ class TimelineController extends EventHandler {

onFragLoaded (data: { frag: Fragment, payload: any }) {
const { frag, payload } = data;
const { cea608Parser, initPTS, lastSn, unparsedVttFrags } = this;
const { cea608Parser, initPTS, unparsedVttFrags } = this;
if (frag.type === 'main') {
const sn = frag.sn;
// if this frag isn't contiguous, clear the parser so cues with bad start/end times aren't added to the textTrack
Expand Down
1 change: 0 additions & 1 deletion src/demux/mp4demuxer.ts
@@ -1,7 +1,6 @@
/**
* MP4 demuxer
*/
import { logger } from '../utils/logger';
import { Demuxer, DemuxerResult, DemuxedTrack } from '../types/demuxer';
import { findBox, segmentValidRange, appendUint8Array } from '../utils/mp4-tools';
import { dummyTrack } from './dummy-demuxed-track';
Expand Down

0 comments on commit a8f1a7e

Please sign in to comment.