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

Fix mid-stream insertion of missing AAC audio frames #3997

Merged
merged 1 commit into from Jun 4, 2021
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
6 changes: 2 additions & 4 deletions src/remux/mp4-remuxer.ts
Expand Up @@ -683,7 +683,6 @@ export default class MP4Remuxer implements Remuxer {

let inputSamples: Array<AudioSample> = track.samples;
let offset: number = rawMPEG ? 0 : 8;
let fillFrame: any;
let nextAudioPts: number = this.nextAudioPts || -1;

// window.audioSamples ? window.audioSamples.push(inputSamples.map(s => s.pts)) : (window.audioSamples = [inputSamples.map(s => s.pts)]);
Expand Down Expand Up @@ -766,9 +765,8 @@ export default class MP4Remuxer implements Remuxer {
(1000 * delta) / inputTimeScale
)} ms.`
);
this.nextAudioPts = nextAudioPts = pts;
this.nextAudioPts = nextAudioPts = nextPts = pts;
}
nextPts = pts;
} // eslint-disable-line brace-style

// Insert missing frames if:
Expand Down Expand Up @@ -801,7 +799,7 @@ export default class MP4Remuxer implements Remuxer {
);
for (let j = 0; j < missing; j++) {
const newStamp = Math.max(nextPts as number, 0);
fillFrame = AAC.getSilentFrame(
let fillFrame = AAC.getSilentFrame(
track.manifestCodec || track.codec,
track.channelCount
);
Expand Down