Comparing version 1.4.0 to 1.4.1
@@ -40,3 +40,3 @@ /** | ||
if (track && track.channelcount === undefined) { | ||
if (track) { | ||
track.audioobjecttype = data.audioobjecttype; | ||
@@ -77,2 +77,3 @@ track.channelcount = data.channelcount; | ||
track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts); | ||
track.minSegmentPts = track.minSegmentDts; | ||
return true; | ||
@@ -117,2 +118,3 @@ } | ||
clearDtsInfo(track); | ||
this.trigger('data', {track: track, boxes: boxes}); | ||
@@ -137,2 +139,3 @@ this.trigger('done'); | ||
pps; | ||
VideoSegmentStream.prototype.init.call(this); | ||
@@ -297,3 +300,3 @@ | ||
/** | ||
* Store information about the start and end of the tracka and the | ||
* Store information about the start and end of the track and the | ||
* duration for each frame/sample we process in order to calculate | ||
@@ -307,2 +310,14 @@ * the baseMediaDecodeTime | ||
} | ||
if (track.minSegmentPts === undefined) { | ||
track.minSegmentPts = data.pts; | ||
} else { | ||
track.minSegmentPts = Math.min(track.minSegmentPts, data.pts); | ||
} | ||
if (track.maxSegmentPts === undefined) { | ||
track.maxSegmentPts = data.pts; | ||
} else { | ||
track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts); | ||
} | ||
} | ||
@@ -336,2 +351,4 @@ | ||
delete track.maxSegmentDts; | ||
delete track.minSegmentPts; | ||
delete track.maxSegmentPts; | ||
}; | ||
@@ -347,6 +364,24 @@ | ||
oneSecondInPTS = 90000, // 90kHz clock | ||
scale; | ||
scale, | ||
// Calculate the distance, in time, that this segment starts from the start | ||
// of the timeline (earliest time seen since the transmuxer initialized) | ||
timeSinceStartOfTimeline = track.minSegmentDts - track.timelineStartInfo.dts, | ||
// Calculate the first sample's effective compositionTimeOffset | ||
firstSampleCompositionOffset = track.minSegmentPts - track.minSegmentDts; | ||
track.baseMediaDecodeTime = track.minSegmentDts - track.timelineStartInfo.dts + track.timelineStartInfo.baseMediaDecodeTime; | ||
// track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where | ||
// we want the start of the first segment to be placed | ||
track.baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; | ||
// Add to that the distance this segment is from the very first | ||
track.baseMediaDecodeTime += timeSinceStartOfTimeline; | ||
// Subtract this segment's "compositionTimeOffset" so that the first frame of | ||
// this segment is displayed exactly at the `baseMediaDecodeTime` or at the | ||
// end of the previous segment | ||
track.baseMediaDecodeTime -= firstSampleCompositionOffset; | ||
// baseMediaDecodeTime must not become negative | ||
track.baseMediaDecodeTime = Math.max(0, track.baseMediaDecodeTime); | ||
if (track.type === 'audio') { | ||
@@ -593,3 +628,2 @@ // Audio has a different clock equal to the sampling_rate so we need to | ||
audioTrack.timelineStartInfo = timelineStartInfo; | ||
// On the first segment we trim AAC frames that exist before the | ||
@@ -596,0 +630,0 @@ // very earliest DTS we have seen in video because Chrome will |
{ | ||
"name": "mux.js", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "A collection of lightweight utilities for inspecting and manipulating video container formats.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3553966
55960