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

Bugfix: segment_duration and media_time use different units #1792

Merged

Conversation

ybai001
Copy link
Contributor

@ybai001 ybai001 commented Oct 9, 2024

According to ISO 14496-12, section 8.6.6.3,

segment_duration is an integer that specifies the duration of this edit segment in units of the
timescale in the Movie Header Box
media_time is an integer containing the starting time within the media of this edit segment (in
media time scale units, in composition time). If this field is set to –1, it is an empty edit. The last
edit in a track shall never be an empty edit. Any difference between the duration in the Movie
Header Box, and the track’s duration is expressed as an implicit empty edit at the end.

segment_duration is based on timescale in movie header box(mdhd)
media_time is based on timescale track header/media timescale

So segment_duration and media_time use different units.

The implementation in other Media3 codes/AOSP are correct, such as
(1) BoxParser.java line 712, 714, 716--718 and 731: https://github.com/androidx/media/blob/main/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/BoxParser.java#L712
(2) On AOSP https://cs.android.com/android/platform/superproject/main/+/main:frameworks/av/media/module/extractors/mp4/MPEG4Extractor.cpp;l=583

@rohitjoins rohitjoins self-assigned this Oct 14, 2024
@rohitjoins
Copy link
Contributor

I'm going to send this for internal review now. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks!

@copybara-service copybara-service bot merged commit 4df9d4e into androidx:main Oct 14, 2024
1 check passed
@ybai001 ybai001 deleted the dlb/elst-handling/dev branch October 15, 2024 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants