Skip to content

Commit

Permalink
Allow variable-length audio packets in AudioSegmentStream
Browse files Browse the repository at this point in the history
FLAC may have variable-length packets, so allow passing a
duration in samples on incoming frames.

This gets FLAC with, say, 960 samples per frame working
consistently in Firefox and Chrome.
  • Loading branch information
bvibber committed Jun 1, 2019
1 parent a9a6527 commit f70bf1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mp4/audio-frame-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var generateSampleTable = function(frames) {
currentFrame = frames[i];
samples.push({
size: currentFrame.data.byteLength,
duration: 1024 // For AAC audio, all samples contain 1024 samples
duration: currentFrame.duration || 1024 // For AAC audio, all samples contain 1024 samples
});
}
return samples;
Expand Down

0 comments on commit f70bf1f

Please sign in to comment.