unexpected InvalidStateError exception with MediaSource.endOfStream() and short-duration last frame
Categories
(Core :: Audio/Video: Playback, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox132 | --- | fixed |
People
(Reporter: karlt, Assigned: karlt)
References
(Regressed 1 open bug)
Details
Attachments
(2 files)
https://pernos.co/debug/jm31IX8m_dYmE21IFNorXA/index.html records a case where endOfStream() throws because the result of GetHighestBufferedEndTime() is truncated to microseconds before being compared with HighestStartTime() for the exception. When the last frame is short enough, the highest start time can be greater than the truncated highest end time. In this case the last frame has zero duration for reasons described in bug 1916305, but the same can occur with non-zero-duration frames when the sample time denominator is larger than 10^6.
TimeUnit durations are subsequently truncated to microseconds by MediaSourceDecoder::SetMediaSourceDuration(), though the conversion to double seconds before multiplication by 10^6 and truncation may in edge cases lead to slightly different results than ToBase(), which multiplies before the double precision division. The SourceBuffer.buffered getter also uses ToBase().
The reasons for microsecond precision are given in commit messages as
The truncation to microseconds in endOfStream() may still serve a purpose, despite subsequent truncation, for the comparison with mDecoder->GetDuration(), the value of which may have been truncated when it was set.
| Assignee | ||
Comment 1•1 year ago
|
||
| Assignee | ||
Comment 2•1 year ago
|
||
Microsecond truncation of duration but not highest start time was sometimes
causing inappropriate InvalidStateError.
HighestStartTime() is more efficient than and equivalent when Ended to
GetHighestBufferedEndTime(), which constructs full TimeIntervals.
Use ToBase(USECS_PER_S) for rounding for consistency with the
SourceBuffer.buffered getter.
https://hg.mozilla.org/mozilla-central/rev/8fa884b2475d
https://hg.mozilla.org/mozilla-central/rev/8a75f0122998
Description
•