Skip to content

Commit

Permalink
Fix issue in TS Demuxer that skipped AAC frames at the end of PES pac…
Browse files Browse the repository at this point in the history
…kets

Fixes #2528
  • Loading branch information
Rob Walch committed Feb 17, 2020
1 parent 16769c8 commit 2360a6c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/demux/tsdemuxer.js
Expand Up @@ -995,15 +995,21 @@ class TSDemuxer {

// scan for aac samples
while (offset < len) {
if (ADTS.isHeader(data, offset) && (offset + 5) < len) {
let frame = ADTS.appendFrame(track, data, offset, pts, frameIndex);
if (frame) {
// logger.log(`${Math.round(frame.sample.pts)} : AAC`);
offset += frame.length;
stamp = frame.sample.pts;
frameIndex++;
if (ADTS.isHeader(data, offset)) {
if ((offset + 5) < len) {
let frame = ADTS.appendFrame(track, data, offset, pts, frameIndex);
if (frame) {
// logger.log(`${Math.round(frame.sample.pts)} : AAC`);
offset += frame.length;
stamp = frame.sample.pts;
frameIndex++;
} else {
// Remaining data will be added to aacOverFlow
// logger.log('Unable to parse AAC frame');
break;
}
} else {
// logger.log('Unable to parse AAC frame');
// Remaining data will be added to aacOverFlow
break;
}
} else {
Expand Down

0 comments on commit 2360a6c

Please sign in to comment.