Rewrite TimeUnit.h
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox115 | --- | fixed |
People
(Reporter: padenot, Assigned: padenot)
References
(Regressed 1 open bug)
Details
Attachments
(31 files, 1 obsolete file)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
TimeUnit.h
internally uses integer microseconds, which is not precise enough is a number of scenarios, especially for audio. Rounding is inconsistent, and causes subtle issues.
It needs to use a fractional representation, with a numerator and a denominator, (this is often how it works in media systems).
For audio, the denominator frequently is the sample-rate of the audio stream, and the numerator frequently is the frame number (but can be anything as long as it converts to a number of seconds in the end).
For video, it's frequent that the container contains a denominator (called the timestamp scale or time base, or something else, depending on the container) that's related to the frame rate. Again, the numerator allows converting properly to seconds (and any other useful unit).
It's possible to use timebase-based TimeUnit
together regardless of the time unit because it all translates back to seconds in the end if needed (with the maximum precision possible, since it's the original number without conversion).
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D171255
Updated•2 years ago
|
Updated•2 years ago
|
Comment 3•2 years ago
|
||
The severity field is not set for this bug.
:jimm, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 4•2 years ago
|
||
Assignee | ||
Comment 5•2 years ago
|
||
Depends on D171256
Assignee | ||
Comment 6•2 years ago
|
||
Depends on D173304
Assignee | ||
Comment 7•2 years ago
|
||
Depends on D173305
Assignee | ||
Comment 8•2 years ago
|
||
This still gets the initial time value from mp4parse-rust, that is in
microseconds. mp4parse-rust has been updated to expose real time, and will be
updated later.
Depends on D173306
Assignee | ||
Comment 9•2 years ago
|
||
Fairly straightforward.
Depends on D173307
Assignee | ||
Comment 10•2 years ago
|
||
Just using TimeUnit instead of seconds in doubles. Some IsValid()
checks added
because quite NaNs were used previously.
Depends on D173308
Assignee | ||
Comment 11•2 years ago
|
||
Nothing major, except Infinity is now represented explicitly, and that it's
necessary to lower the precision of some values (using the method
ToMicrosecondResolution()
) that end up visible by script to ensure that
there's no change in behaviour. When not doing that, the reported numbers have
higher precision -- we keep with the same precision for now.
Depends on D173309
Assignee | ||
Comment 12•2 years ago
|
||
Similarly to the previous patch, it's necessary to reduce the resolution of
values visible from script to keep the exact same behaviour as before. We might
be able to remove this eventually but it might not be very useful to do so, the
benefits of using rational-based time are mostly for internal computations.
Depends on D173310
Assignee | ||
Comment 13•2 years ago
|
||
This one tricky bit is when appending frames to the internal buffer. We want to
do all computations in the time base of the container, that's more precise. When
the offset is set by js (as a 64-bits double, converted to integer
microseconds), we convert it to the time base of the track, and accumulate this
way, to have minimal error.
Depends on D173311
Assignee | ||
Comment 14•2 years ago
|
||
Similarly to other commits, it's necessary to sometimes reduce the precision of
returned time values, to ensure there's no change to returned numbers.
Depends on D173312
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 15•2 years ago
|
||
Depends on D173315
Assignee | ||
Comment 16•2 years ago
|
||
Depends on D173528
Assignee | ||
Comment 17•2 years ago
|
||
Two tests are adjusted to round differently, this doesn't have real
consequences.
For the third test the result should really be 0 (the segments are of the same
duration), but it was a very small number (about 1us in seconds) before because
of rounding.
Depends on D173529
Assignee | ||
Comment 18•2 years ago
|
||
Depends on D176036
Assignee | ||
Comment 19•2 years ago
|
||
Depends on D176037
Assignee | ||
Comment 20•2 years ago
|
||
Depends on D176038
Assignee | ||
Comment 21•2 years ago
|
||
Depends on D176039
Assignee | ||
Comment 22•2 years ago
|
||
Depends on D176040
Assignee | ||
Comment 23•2 years ago
|
||
When playing a MediaSource, seekable
should return [0, duration]
, and duration
can be a double of any precision.
Depends on D176041
Assignee | ||
Comment 24•2 years ago
|
||
The new unit simply accumulates the internal mp4 ticks, no rounding occur.
Depends on D176042
Assignee | ||
Comment 25•2 years ago
|
||
Depends on D176043
Assignee | ||
Comment 26•2 years ago
|
||
Depends on D176044
Assignee | ||
Comment 27•2 years ago
|
||
Depends on D176045
Assignee | ||
Comment 28•2 years ago
|
||
Depends on D176047
Assignee | ||
Comment 29•2 years ago
|
||
Depends on D176049
Assignee | ||
Comment 30•2 years ago
|
||
Some of those are not avoidable: we use int64_t inside TimeUnit, and mp4 uses
u64 as the numerator. It's not problematic in practice.
Depends on D176050
Assignee | ||
Comment 31•2 years ago
|
||
This switches to using seconds, adds more decimals, and uses proper floating
point comparison functions.
We're not using microseconds here because this test intentionally uses value
that are the maximum and minimum of int64_t and that overflows TimeUnit.
Depends on D176051
Assignee | ||
Comment 32•2 years ago
|
||
This is useful when dealing with Windows media APIs.
Depends on D176052
Comment 33•1 years ago
|
||
Comment 34•1 years ago
|
||
Comment 35•1 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b20cc750c020
https://hg.mozilla.org/mozilla-central/rev/41c0bd1133c5
https://hg.mozilla.org/mozilla-central/rev/697ec1928f9c
https://hg.mozilla.org/mozilla-central/rev/2d88a5915db9
https://hg.mozilla.org/mozilla-central/rev/ea1aebd4e245
https://hg.mozilla.org/mozilla-central/rev/66e4a26e1ebe
https://hg.mozilla.org/mozilla-central/rev/89c241451a32
https://hg.mozilla.org/mozilla-central/rev/7f64e65d9497
https://hg.mozilla.org/mozilla-central/rev/29f7cd2b341c
https://hg.mozilla.org/mozilla-central/rev/7af506896930
https://hg.mozilla.org/mozilla-central/rev/8e0dcf163138
https://hg.mozilla.org/mozilla-central/rev/412e0a9ec4e8
https://hg.mozilla.org/mozilla-central/rev/b86b569ecd46
https://hg.mozilla.org/mozilla-central/rev/c1ac4c31ad9a
https://hg.mozilla.org/mozilla-central/rev/2952a6fa06e5
https://hg.mozilla.org/mozilla-central/rev/d096b9cc905d
https://hg.mozilla.org/mozilla-central/rev/e589b4d30995
https://hg.mozilla.org/mozilla-central/rev/f516a428ba32
https://hg.mozilla.org/mozilla-central/rev/35ab3ed5e3fc
https://hg.mozilla.org/mozilla-central/rev/25ecea0f3d49
https://hg.mozilla.org/mozilla-central/rev/deea3077f762
https://hg.mozilla.org/mozilla-central/rev/670c599a3b99
https://hg.mozilla.org/mozilla-central/rev/8fca27bd0f6b
https://hg.mozilla.org/mozilla-central/rev/d5d5d390dcbf
https://hg.mozilla.org/mozilla-central/rev/b9f2e1155bd7
https://hg.mozilla.org/mozilla-central/rev/54c3294f0839
https://hg.mozilla.org/mozilla-central/rev/14b061d0f595
https://hg.mozilla.org/mozilla-central/rev/0ef13d357ee3
https://hg.mozilla.org/mozilla-central/rev/2d92f903dd66
https://hg.mozilla.org/mozilla-central/rev/4b42659090f3
https://hg.mozilla.org/mozilla-central/rev/011cece33b0d
https://hg.mozilla.org/mozilla-central/rev/f2113c9b661f
Comment 36•1 years ago
|
||
Backed out 80 changesets (bug 1821362, bug 1703812, bug 1817997) for causing media crashes as in Bug 1833890.
Backout link: https://hg.mozilla.org/mozilla-central/rev/225c5ab0d999e743db5298d125893ae0702884af
Updated•1 years ago
|
Comment 37•1 years ago
|
||
Assignee | ||
Comment 38•1 years ago
|
||
Comment 39•1 years ago
|
||
Comment 40•1 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2783a65c89d2
https://hg.mozilla.org/mozilla-central/rev/ca9a94f33590
https://hg.mozilla.org/mozilla-central/rev/1346f08e6f53
https://hg.mozilla.org/mozilla-central/rev/78068c6cc38f
https://hg.mozilla.org/mozilla-central/rev/9390bcf9c450
https://hg.mozilla.org/mozilla-central/rev/5c1b6ce71ca1
https://hg.mozilla.org/mozilla-central/rev/aa102eb9990d
https://hg.mozilla.org/mozilla-central/rev/ab33bd048f67
https://hg.mozilla.org/mozilla-central/rev/c134f0bfd5a7
https://hg.mozilla.org/mozilla-central/rev/a724c0f009c6
https://hg.mozilla.org/mozilla-central/rev/e62d04495fb9
https://hg.mozilla.org/mozilla-central/rev/4b27b9b20884
https://hg.mozilla.org/mozilla-central/rev/280227568779
https://hg.mozilla.org/mozilla-central/rev/9d931c8093da
https://hg.mozilla.org/mozilla-central/rev/d4b97015415c
https://hg.mozilla.org/mozilla-central/rev/286d9df49c11
https://hg.mozilla.org/mozilla-central/rev/ab6f987c4ffb
https://hg.mozilla.org/mozilla-central/rev/b3bb60a62ab2
https://hg.mozilla.org/mozilla-central/rev/881e88b4838f
https://hg.mozilla.org/mozilla-central/rev/3ed87ad54085
https://hg.mozilla.org/mozilla-central/rev/f4449389bc7e
https://hg.mozilla.org/mozilla-central/rev/2a6dd728562a
https://hg.mozilla.org/mozilla-central/rev/6b1e4a1707b4
https://hg.mozilla.org/mozilla-central/rev/dfbcc10a5e18
https://hg.mozilla.org/mozilla-central/rev/5a913935f40c
https://hg.mozilla.org/mozilla-central/rev/d60b7a400022
https://hg.mozilla.org/mozilla-central/rev/989a3c429c92
https://hg.mozilla.org/mozilla-central/rev/f6514dccc516
https://hg.mozilla.org/mozilla-central/rev/28f2d9948ecf
https://hg.mozilla.org/mozilla-central/rev/dc3d93ab3284
https://hg.mozilla.org/mozilla-central/rev/2ea75ac1b073
https://hg.mozilla.org/mozilla-central/rev/56ed4f603735
Updated•1 years ago
|
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•6 months ago
|
Description
•