Skip to content

Commit

Permalink
fix: parse captions from tracks with trackId of zero (#247)
Browse files Browse the repository at this point in the history
While this goes against the spec, there's broken content out there and it's easy to add with minimal maintenance burden.
  • Loading branch information
tylerdaines authored and gkatsev committed Jul 23, 2019
1 parent 06923e8 commit 915d3f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/mp4/caption-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ var parseCaptionNals = function(segment, videoTrackId) {
var parseEmbeddedCaptions = function(segment, trackId, timescale) {
var seiNals;

if (!trackId) {
// the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there
if (trackId === null) {
return null;
}

Expand Down Expand Up @@ -332,8 +333,9 @@ var CaptionParser = function() {
timescale = timescales[trackId];

// If an init segment has not been seen yet, hold onto segment
// data until we have one
} else if (!trackId || !timescale) {
// data until we have one.
// the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there
} else if (trackId === null || !timescale) {
segmentCache.push(segment);
return null;
}
Expand Down

0 comments on commit 915d3f9

Please sign in to comment.