Skip to content

Commit e20a902

Browse files
author
jrivera
committed
Hack to still emit done even when there is only 1 elementary stream with data
1 parent 050cc7b commit e20a902

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/mp4/transmuxer.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -819,9 +819,18 @@ CoalesceStream.prototype.flush = function() {
819819
i;
820820

821821
// Return until we have enough tracks from the pipeline to remux
822-
if (this.pendingTracks.length === 0 ||
823-
(this.remuxTracks && this.pendingTracks.length < this.numberOfTracks)) {
824-
return;
822+
if (this.pendingTracks.length < this.numberOfTracks) {
823+
if (this.remuxTracks) {
824+
return;
825+
} else if (this.pendingTracks.length === 0) {
826+
this.emittedTracks++;
827+
828+
if (this.emittedTracks >= this.numberOfTracks) {
829+
this.trigger('done');
830+
this.emittedTracks = 0;
831+
}
832+
return;
833+
}
825834
}
826835

827836
if (this.videoTrack) {

0 commit comments

Comments
 (0)