Skip to content

Commit

Permalink
mp4-remuxer : sort audio frames prior remuxing
Browse files Browse the repository at this point in the history
should improve out of sync issue happening on
https://github.com/dailymotion/hls.js/issues/218
  • Loading branch information
mangui committed Feb 1, 2016
1 parent 73d5bfe commit e8c7bed
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/remux/mp4-remuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,10 @@ class MP4Remuxer {
samples = [],
samples0 = [];

track.samples.forEach(aacSample => {
if(pts === undefined || aacSample.pts > pts) {
samples0.push(aacSample);
pts = aacSample.pts;
} else {
logger.warn('dropping past audio frame');
track.len -= aacSample.unit.byteLength;
}
track.samples.sort(function(a, b) {
return (a.pts-b.pts);
});
samples0 = track.samples;

while (samples0.length) {
aacSample = samples0.shift();
Expand Down

0 comments on commit e8c7bed

Please sign in to comment.