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

Chrome 74 and lower mp4-remuxer fix #2995

Merged
merged 1 commit into from Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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