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 12f2e16 commit be895da
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/demux/tsdemuxer.js
Expand Up @@ -1036,15 +1036,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) {
const 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 be895da

Please sign in to comment.