Skip to content

Commit

Permalink
Fix mp4-remux CHUNK_DEMUXER_ERROR_APPEND_FAILED in Chrome 74 and lowe…
Browse files Browse the repository at this point in the history
…rs and Chromium based browsers like Opera
  • Loading branch information
Rob Walch committed Aug 25, 2020
1 parent fc71d81 commit 4e44c77
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/remux/mp4-remuxer.js
Expand Up @@ -15,12 +15,18 @@ import { logger } from '../utils/logger';
const MAX_SILENT_FRAME_DURATION_90KHZ = toMpegTsClockFromTimescale(10);
const PTS_DTS_SHIFT_TOLERANCE_90KHZ = toMpegTsClockFromTimescale(0.2);

let chromeVersion = null;

class MP4Remuxer {
constructor (observer, config, typeSupported, vendor) {
this.observer = observer;
this.config = config;
this.typeSupported = typeSupported;
this.ISGenerated = false;
if (chromeVersion === null) {
const result = navigator.userAgent.match(/Chrome\/(\d+)/i);
chromeVersion = result ? parseInt(result[1]) : 0;
}
}

destroy () {
Expand Down Expand Up @@ -308,6 +314,9 @@ class MP4Remuxer {
}
}

if (chromeVersion && chromeVersion < 75) {
firstDTS = Math.max(0, firstDTS);
}
let nbNalu = 0;
let naluLen = 0;
for (let i = 0; i < nbSamples; i++) {
Expand Down

0 comments on commit 4e44c77

Please sign in to comment.