Skip to content
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

Divide duration of inband events by timescale #3991

Merged
merged 1 commit into from Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/dash/DashAdapter.js
Expand Up @@ -448,7 +448,7 @@ function DashAdapter() {
* Returns the event for the given parameters.
* @param {object} eventBox
* @param {object} eventStreams
* @param {number} mediaStartTime
* @param {number} mediaStartTime - Specified in seconds
* @param {object} voRepresentation
* @returns {null|Event}
* @memberOf module:DashAdapter
Expand All @@ -472,8 +472,10 @@ function DashAdapter() {
const timescale = eventBox.timescale || 1;
const periodStart = voRepresentation.adaptation.period.start;
const eventStream = eventStreams[schemeIdUri + '/' + value];
// The PTO in voRepresentation is already specified in seconds
const presentationTimeOffset = !isNaN(voRepresentation.presentationTimeOffset) ? voRepresentation.presentationTimeOffset : !isNaN(eventStream.presentationTimeOffset) ? eventStream.presentationTimeOffset : 0;
let presentationTimeDelta = eventBox.presentation_time_delta / timescale; // In case of version 1 events the presentation_time is parsed as presentation_time_delta
// In case of version 1 events the presentation_time is parsed as presentation_time_delta
let presentationTimeDelta = eventBox.presentation_time_delta / timescale;
let calculatedPresentationTime;

if (eventBox.version === 0) {
Expand All @@ -482,7 +484,7 @@ function DashAdapter() {
calculatedPresentationTime = periodStart - presentationTimeOffset + presentationTimeDelta;
}

const duration = eventBox.event_duration;
const duration = eventBox.event_duration / timescale;
const id = eventBox.id;
const messageData = eventBox.message_data;

Expand Down