Skip to content

Commit

Permalink
Merge pull request #3997 from video-dev/bugfix/aac-frame-insertion
Browse files Browse the repository at this point in the history
Fix mid-stream insertion of missing AAC audio frames
  • Loading branch information
robwalch committed Jun 4, 2021
2 parents bee7507 + 446cc8a commit 1e749eb
Showing 1 changed file with 2 additions and 4 deletions.
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

0 comments on commit 1e749eb

Please sign in to comment.