Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds check to emit fragments on keyframe boundaries when rapAlignement is set #388

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/isofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,11 @@ ISOFile.prototype.processSamples = function(last) {
/* The fragment could not be created because the media data is not there (not downloaded), wait for it */
break;
}
var nextSample = trak.samples[trak.nextSample];
var emitForRapBoundary = fragTrak.rapAlignement && nextSample && nextSample.is_sync;
/* A fragment is created by sample, but the segment is the accumulation in the buffer of these fragments.
It is flushed only as requested by the application (nb_samples) to avoid too many callbacks */
if (trak.nextSample % fragTrak.nb_samples === 0 || (last || trak.nextSample >= trak.samples.length)) {
if (emitForRapBoundary || trak.nextSample % fragTrak.nb_samples === 0 || (last || trak.nextSample >= trak.samples.length)) {
Log.info("ISOFile", "Sending fragmented data on track #"+fragTrak.id+" for samples ["+Math.max(0,trak.nextSample-fragTrak.nb_samples)+","+(trak.nextSample-1)+"]");
Log.info("ISOFile", "Sample data size in memory: "+this.getAllocatedSampleDataSize());
if (this.onSegment) {
Expand Down