Skip to content

Commit

Permalink
Fix for crash on missing PTS/DTS information on keyframes in ts-inspe…
Browse files Browse the repository at this point in the history
…ctor

Fixes issue: videojs#250
  • Loading branch information
cmacq2 committed Mar 13, 2019
1 parent 511d4da commit 9654c23
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/tools/ts-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,15 @@ var parseVideoPes_ = function(bytes, pmt, result) {
i += pes.byteLength;
}
if (probe.ts.videoPacketContainsKeyFrame(frame)) {
result.firstKeyFrame = probe.ts.parsePesTime(frame);
result.firstKeyFrame.type = 'video';
var firstKeyFrame = probe.ts.parsePesTime(frame);

// PTS/DTS may not be available. Simply *not* setting
// the keyframe seems to work fine with HLS playback
// and definitely preferable to a crash with TypeError...
if (firstKeyFrame) {
result.firstKeyFrame = firstKeyFrame;
result.firstKeyFrame.type = 'video';
}
}
currentFrame.size = 0;
}
Expand Down

0 comments on commit 9654c23

Please sign in to comment.