-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improvement of segment timeline $Time$ accuracy #706
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ shaka.dash.MpdUtils.GAP_OVERLAP_TOLERANCE_SECONDS = 1 / 15; | |
/** | ||
* @typedef {{ | ||
* start: number, | ||
* unscaledStart: number, | ||
* end: number | ||
* }} | ||
* | ||
|
@@ -52,6 +53,8 @@ shaka.dash.MpdUtils.GAP_OVERLAP_TOLERANCE_SECONDS = 1 / 15; | |
* | ||
* @property {number} start | ||
* The start time of the range. | ||
* @property {number} unscaledStart | ||
* The start time of the range in representation timescale units. | ||
* @property {number} end | ||
* The end time (exclusive) of the range. | ||
*/ | ||
|
@@ -64,6 +67,7 @@ shaka.dash.MpdUtils.TimeRange; | |
* segmentDuration: ?number, | ||
* startNumber: number, | ||
* presentationTimeOffset: number, | ||
* unscaledPresentationTimeOffset: number, | ||
* timeline: Array.<shaka.dash.MpdUtils.TimeRange> | ||
* }} | ||
* | ||
|
@@ -78,6 +82,8 @@ shaka.dash.MpdUtils.TimeRange; | |
* The start number of the segments; 1 or greater. | ||
* @property {number} presentationTimeOffset | ||
* The presentationTimeOffset of the representation, in seconds. | ||
* @property {number} unscaledPresentationTimeOffset | ||
* The presentationTimeOffset of the representation, in timescale units. | ||
* @property {Array.<shaka.dash.MpdUtils.TimeRange>} timeline | ||
* The timeline of the representation, if given. Times in seconds. | ||
*/ | ||
|
@@ -269,8 +275,12 @@ shaka.dash.MpdUtils.createTimeline = function( | |
|
||
for (var j = 0; j <= repeat; ++j) { | ||
var endTime = startTime + d; | ||
timeline.push( | ||
{start: (startTime / timescale), end: (endTime / timescale)}); | ||
var item = { | ||
start: startTime / timescale, | ||
end: endTime / timescale, | ||
unscaledStart: startTime | ||
}; | ||
timeline.push(item); | ||
|
||
startTime = endTime; | ||
lastEndTime = endTime; | ||
|
@@ -398,6 +408,7 @@ shaka.dash.MpdUtils.parseSegmentInfo = function(context, callback) { | |
segmentDuration: segmentDuration, | ||
startNumber: startNumber, | ||
presentationTimeOffset: pto, | ||
unscaledPresentationTimeOffset: Number(presentationTimeOffset), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add this field to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will fix. |
||
timeline: timeline | ||
}; | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,7 @@ shaka.dash.SegmentTemplate.createStream = function( | |
* segmentDuration: ?number, | ||
* startNumber: number, | ||
* presentationTimeOffset: number, | ||
* unscaledPresentationTimeOffset: number, | ||
* timeline: Array.<shaka.dash.MpdUtils.TimeRange>, | ||
* mediaTemplate: ?string, | ||
* indexTemplate: ?string | ||
|
@@ -131,6 +132,8 @@ shaka.dash.SegmentTemplate.createStream = function( | |
* The start number of the segments; 1 or greater. | ||
* @property {number} presentationTimeOffset | ||
* The presentationTimeOffset of the representation, in seconds. | ||
* @property {number} unscaledPresentationTimeOffset | ||
* The presentationTimeOffset of the representation, in timescale units. | ||
* @property {Array.<shaka.dash.MpdUtils.TimeRange>} timeline | ||
* The timeline of the representation, if given. Times in seconds. | ||
* @property {?string} mediaTemplate | ||
|
@@ -174,6 +177,7 @@ shaka.dash.SegmentTemplate.parseSegmentTemplateInfo_ = function(context) { | |
timescale: segmentInfo.timescale, | ||
startNumber: segmentInfo.startNumber, | ||
presentationTimeOffset: segmentInfo.presentationTimeOffset, | ||
unscaledPresentationTimeOffset: segmentInfo.unscaledPresentationTimeOffset, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add this field to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will fix. |
||
timeline: segmentInfo.timeline, | ||
mediaTemplate: media, | ||
indexTemplate: index | ||
|
@@ -357,16 +361,16 @@ shaka.dash.SegmentTemplate.createFromTimeline_ = function(context, info) { | |
var references = []; | ||
for (var i = 0; i < info.timeline.length; i++) { | ||
var start = info.timeline[i].start; | ||
var unscaledStart = info.timeline[i].unscaledStart; | ||
var end = info.timeline[i].end; | ||
|
||
// Note: i = k - 1, where k indicates the k'th segment listed in the MPD. | ||
// (See section 5.3.9.5.3 of the DASH spec.) | ||
var segmentReplacement = i + info.startNumber; | ||
|
||
// Consider the presentation time offset in segment uri computation | ||
var timeReplacement = (start + info.presentationTimeOffset) * | ||
info.timescale; | ||
|
||
var timeReplacement = unscaledStart + | ||
info.unscaledPresentationTimeOffset; | ||
var createUris = (function( | ||
template, repId, bandwidth, baseUris, segmentId, time) { | ||
var mediaUri = MpdUtils.fillUriTemplate( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this field to the
shaka.dash.MpdUtils.TimeRange
definition.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Missed that. Will fix. Thanks.