androidx / androidx/media

period@start time is missing in presentationTimesUs calculation of EventStream

Open
#2,106 6 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Feb 4, 2025.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 main branch

More version details

We have encountered with an issue with the Event@presentationTime calculation in Exo Player. Based on the Exo Player logic, the event’s presentation time is calculated as:
Event@presentationTime - EventStream@presentationTimeOffset

Here is the manifest for reference:

<Period id="173" start="PT14H17M58S">
  <EventStream schemeIdUri="metadata-update" timescale="1000" presentationTimeOffset="51478000">
    <Event presentationTime="11211" id="2054">...</Event>
...

This results in a presentation time of -51466789, which is way before the Period's start time and this appears incorrect.

Referencing the MPD events timing model in the DASH spec, The formula for the event start:

The ST of an MPD event, relative to period start time of Period containing the Event, can be calculated using values in its EventStream and Event elements:
ST = PST + (PT - PTO)/TS
where:
— PST is the Period start time of the Period containing the event stream.
— PTO is the presentation time offset of the Event Stream provided by EventStream@presentationTimeoffset.
— TS is the value of EventStream@timescale.
— PT is the value of EventStream@presentationTime.

Which is:
PST = PT14H17M58S = 51478S
PT = 11211
PTO = 51478000
TS = 1000
Based on the given formula:
ST = PST + (PT - PTO) / TS
The calculated Event Start Time is 11.211 seconds.

However, ExoPlayer provides a presentation time of -51466789, which indicates that ExoPlayer does not appear to follow the latest DASH specification (Edition 5).

Dash Spec: https://standards.iso.org/ittf/PubliclyAvailableStandards/c083314_ISO_IEC%2023009-1_2022(en).zip

I checked the Exo Player code and found that parseEvent() API of DashManifestParser, It calculates the presentationTime time as below:

    long presentationTimesUs =
        Util.scaleLargeTimestamp(
            presentationTime - presentationTimeOffset, C.MICROS_PER_SECOND, timescale);

Which does not follows the latest Dash Spec(Edition 5).

Reference:
Image

Devices that reproduce the issue

Any Android Device

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Play a live event which has the EventStream with EventStream@presentationTimeOffset and EventStream@presentationTime.
When we get the EventStream.presentationTimesUs it returns the incorrect PT time.

Expected result

While creating the EventStream instance, We should also add the period@start time in presentationTimesUs to follow the DASH specification.

Actual result

While creating the EventStream instance, We are not adding the period@start time in presentationTimesUs.

Media

NA

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.