Bug 20901 - contiguous splice/append without knowing media segment internal timestamps
Summary: contiguous splice/append without knowing media segment internal timestamps
Alias: None
Product: HTML WG
Classification: Unclassified
Component: Media Source Extensions (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Aaron Colwell (c)
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2013-02-07 23:59 UTC by Michael Thornburgh
Modified: 2013-05-06 21:59 UTC (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Thornburgh 2013-02-07 23:59:14 UTC
some media formats, such as Apple's HTTP Live Streaming (HLS), do not include information about the internal timestamps of media segments in the format's index/manifest files (.m3u8 in the HLS case). the HLS semantic is that media segments are contiguous in their listed order, and timestamps are used only for media track synchronization within a continuity era.  continuity eras are delimited by a discontinuity indicator in the manifest file (.m3u8 in this case).

the current Media Source Extensions specification requires the application to know the internal media timestamps of media segments in order to position the segments in the time line.  this information is unnecessary in the simple (linear contiguous append) case and, as stated above, may not be readily available without parsing the media segments themselves.

there should be a way to perform at least a simple append of media segments into the decoder buffer for contiguous linear playback without knowing the internal media segment timestamps, while maintaining cross-track synchronization even when there are media stream/track discontinuities.

a suggested solution is to provide an indicator to abort() to signal "beginning of next segment is aligned to timestampOffset".  in the case of MPEG-2 Transport Streams, this would modify the calculation of MPEG2TS_timestampOffset at abort() and the following append; other media types would require the definition of a similar timestamp shift facility.

this suggested solution may not be sufficient to maintain synchronization across multiple tracks when they are being appended separately.  further study and discussion is required.
Comment 1 Aaron Colwell (c) 2013-03-05 17:28:11 UTC
Changes committed.
Comment 2 Adrian Bateman [MSFT] 2013-04-23 17:59:52 UTC
I'm reopening this bug based on the discussion on the call:

The result of the change to fix this bug is that out-of-order appends are prohibited without calling abort(). We've observed that this results in needing to commonly call abort before each fragment is appended, which is unnecessary for some formats.

It seems like a solution to the discontinuity issue ought to be needed only when using a format that has this characteristic. Prototyping support for this feature broke all our tests for ISO BMFF.

We don't have a concrete proposal for how to solve this but wonder if something can be added to the appendXXX() methods so that applications using formats that need to deal with discontinuity can indicate whether the append is a continuation. For formats that contain timestamp data, this should not be needed.
Comment 3 Michael Thornburgh 2013-04-23 20:46:54 UTC
both of the current "AbortMode"s are useful, and required for appending discontinuous media broken into separate files, for example separated video and audio. one would use "continuation" with one sequence (say, video) to establish what the new timestamps are, and use "timestampOffset" with the other sequence(s) (say, audio) after discovering what the timestampOffset is from the first sequence, to keep all sequences synchronized by their timestamps.  without this capability and just the equivalent of "continuation", the separate sequences could go out of sync if they don't start all at exactly the same timestamp (which might easily be the case for separated video and audio tracks).

how about keeping the current AbortMode optional parameter for abort(), but allow out-of-order appends without calling abort for all media containers which can reasonably accommodate this, and for situations where you want the discontinuity behavior for formats like ISO BMFF?  it might only be necessary for MPEG-2 TS.

the behavior for abort() when called with no parameters should have been the same as before the AbortMode parameter was added.
Comment 4 Adrian Bateman [MSFT] 2013-04-23 20:55:54 UTC
Discussed in F2F meeting - agreement that we want to make a change here. Editors will discuss and come up with a proposal that removes the overhead from applications that only deal with formats that don't need this capability. We still want to support this for formats like TS.
Comment 5 Aaron Colwell 2013-05-06 15:42:12 UTC
For the record, here is the discussion of the new proposal on public-html-media
Comment 6 Aaron Colwell 2013-05-06 21:59:44 UTC
Changes committed