diff --git a/media-source-respec.html b/media-source-respec.html
index 6e65ddb..6694fea 100644
--- a/media-source-respec.html
+++ b/media-source-respec.html
@@ -247,7 +247,7 @@
Definitions
SourceBuffer byte stream format specification
The specific [=byte stream format specification=] that describes the format of the byte stream accepted by a SourceBuffer instance. The
- [=byte stream format specification=], for a SourceBuffer object, is initially selected based on the type passed to the
+ [=byte stream format specification=], for a SourceBuffer object, is initially selected based on the |type:DOMString| passed to the
{{MediaSource/addSourceBuffer()}} call that created the object, and can be updated by {{SourceBuffer/changeType()}} calls on the object.
SourceBuffer configuration
@@ -358,7 +358,7 @@ Attributes
If the value being set is negative or NaN then throw a {{TypeError}} exception and abort these steps.
If the {{MediaSource/readyState}} attribute is not {{ReadyState/""open""}} then throw an {{InvalidStateError}} exception and abort these steps.
If the {{SourceBuffer/updating}} attribute equals true on any SourceBuffer in {{MediaSource/sourceBuffers}}, then throw an {{InvalidStateError}} exception and abort these steps.
- Run the [=duration change=] algorithm with |new duration| set to the value being assigned to this attribute.
+ Run the [=duration change=] algorithm with |new duration:unrestricted double| set to the value being assigned to this attribute.
The [=duration change=] algorithm will adjust |new duration| higher if there is any currently buffered coded frame with a higher end time.
{{SourceBuffer/appendBuffer()}} and {{MediaSource/endOfStream()}} can update the duration under certain circumstances.
@@ -379,10 +379,10 @@ Attributes
Methods
addSourceBuffer
-
Adds a new SourceBuffer to {{MediaSource/sourceBuffers}}.
- - If type is an empty string then throw a {{TypeError}} exception and abort these steps.
- - If type contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified for the other SourceBuffer objects in {{MediaSource/sourceBuffers}}, then throw a {{NotSupportedError}} exception and abort these steps.
+ - If |type:DOMString| is an empty string then throw a {{TypeError}} exception and abort these steps.
+ - If |type| contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified for the other SourceBuffer objects in {{MediaSource/sourceBuffers}}, then throw a {{NotSupportedError}} exception and abort these steps.
- If the user agent can't handle any more SourceBuffer objects or if creating a SourceBuffer
- based on type would result in an unsupported [=SourceBuffer configuration=],
+ based on |type| would result in an unsupported [=SourceBuffer configuration=],
then throw a {{QuotaExceededError}} exception and abort these steps.
For example, a user agent MAY throw a {{QuotaExceededError}} exception if the media element has reached the
readyState. This can occur if the user agent's media engine does not support adding more tracks during
@@ -393,7 +393,7 @@
Attributes
- Create a new SourceBuffer object and associated resources.
- Set the [=generate timestamps flag=] on the new object to the value in the
"Generate Timestamps Flag" column of the byte stream format registry [[MSE-REGISTRY]] entry
- that is associated with type.
+ that is associated with |type|.
-
- If the [=generate timestamps flag=] equals true:
@@ -411,7 +411,7 @@ Attributes
- Add the new object to {{MediaSource/sourceBuffers}} and [=queue a task=] to [=fire an event=] named {{addsourcebuffer}} at {{MediaSource/sourceBuffers}}.
- Return the new object.
- Parameter | Type | Nullable | Optional | Description |
---|
type | {{DOMString}} | ✘ | ✘ | |
+ Parameter | Type | Nullable | Optional | Description |
---|
|type| | {{DOMString}} | ✘ | ✘ | |
removeSourceBuffer
-
Removes a {{SourceBuffer}} from {{MediaSource/sourceBuffers}}.
@@ -601,7 +601,7 @@ Attributes
- If the {{MediaSource/readyState}} attribute is not in the {{ReadyState/""open""}} state then throw an {{InvalidStateError}} exception and abort these steps.
- If the {{SourceBuffer/updating}} attribute equals true on any SourceBuffer in {{MediaSource/sourceBuffers}}, then throw an {{InvalidStateError}} exception and abort these steps.
- - Run the [=end of stream=] algorithm with the |error:EndOfStreamError| parameter set to |error|.
+ - Run the [=end of stream=] algorithm with the error parameter set to |error:EndOfStreamError|.
Parameter | Type | Nullable | Optional | Description |
---|
|error| | {{EndOfStreamError}} | ✘ | ✔ | |
Return type: {{undefined}}
@@ -611,8 +611,8 @@ Attributes
Updates the [=live seekable range=] variable used in HTMLMediaElement Extensions to modify {{HTMLMediaElement}}.{{HTMLMediaElement/seekable}} behavior.
- If the {{MediaSource/readyState}} attribute is not {{ReadyState/""open""}} then throw an {{InvalidStateError}} exception and abort these steps.
- - If start is negative or greater than end, then throw a {{TypeError}} exception and abort these steps.
- - Set [=live seekable range=] to be a new containing a single range whose start position is start and end position is end.
+
- If |start:double| is negative or greater than |end:double|, then throw a {{TypeError}} exception and abort these steps.
+ - Set [=live seekable range=] to be a new containing a single range whose start position is |start| and end position is |end|.
@@ -624,22 +624,22 @@ Attributes
Description |
- start |
+ |start| |
{{double}} |
✘ |
✘ |
- The start of the range, in seconds measured from [=presentation start time=]. While set, and if {{MediaSource/duration}} equals positive Infinity, {{HTMLMediaElement}}.{{HTMLMediaElement/seekable}} will return a non-empty TimeRanges object with a lowest range start timestamp no greater than start. |
+ The start of the range, in seconds measured from [=presentation start time=]. While set, and if {{MediaSource/duration}} equals positive Infinity, {{HTMLMediaElement}}.{{HTMLMediaElement/seekable}} will return a non-empty TimeRanges object with a lowest range start timestamp no greater than |start|. |
- end |
+ |end| |
{{double}} |
✘ |
✘ |
- The end of range, in seconds measured from [=presentation start time=]. While set, and if {{MediaSource/duration}} equals positive Infinity, {{HTMLMediaElement}}.{{HTMLMediaElement/seekable}} will return a non-empty TimeRanges object with a highest range end timestamp no less than end. |
+ The end of range, in seconds measured from [=presentation start time=]. While set, and if {{MediaSource/duration}} equals positive Infinity, {{HTMLMediaElement}}.{{HTMLMediaElement/seekable}} will return a non-empty TimeRanges object with a highest range end timestamp no less than |end|. |
@@ -654,10 +654,10 @@ Attributes
Check to see whether the MediaSource is capable of creating SourceBuffer objects for the specified MIME type.
- - If type is an empty string, then return false.
- - If type does not contain a valid MIME type string, then return false.
- - If type contains a media type or media subtype that the MediaSource does not support, then return false.
- - If type contains a codec that the MediaSource does not support, then return false.
+ - If |type:DOMString| is an empty string, then return false.
+ - If |type| does not contain a valid MIME type string, then return false.
+ - If |type| contains a media type or media subtype that the MediaSource does not support, then return false.
+ - If |type| contains a codec that the MediaSource does not support, then return false.
- If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false.
- Return true.
@@ -667,7 +667,7 @@ Attributes
This method returning true implies that HTMLMediaElement.canPlayType() will return "maybe" or "probably" since it does not make sense for a MediaSource to support a type the HTMLMediaElement knows it cannot play.
- Parameter | Type | Nullable | Optional | Description |
---|
type | {{DOMString}} | ✘ | ✘ | |
Return type: {{boolean}}
+ Parameter | Type | Nullable | Optional | Description |
---|
|type| | {{DOMString}} | ✘ | ✘ | |
Return type: {{boolean}}
@@ -1054,7 +1054,7 @@ End of stream
If |error| is not set
- - Run the [=duration change=] algorithm with |new duration| set to
+
- Run the [=duration change=] algorithm with |new duration:unrestricted double| set to
the largest [=track buffer ranges=] end time across all the [=track buffers=] across all SourceBuffer objects in {{MediaSource/sourceBuffers}}.
This allows the duration to properly reflect the end of the appended media segments. For example, if the duration was explicitly set to 10 seconds and only media segments for 0 to 5 seconds were appended before endOfStream() was called, then the duration will get updated to 5 seconds.
@@ -1155,8 +1155,8 @@ SourceBuffer Object
- If this object has been removed from the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=], then throw an {{InvalidStateError}} exception and abort these steps.
- If the {{SourceBuffer/updating}} attribute equals true, then throw an {{InvalidStateError}} exception and abort these steps.
- - Let new mode equal the new value being assigned to this attribute.
- - If [=generate timestamps flag=] equals true and new mode equals
+
- Let |new mode:AppendMode| equal the new value being assigned to this attribute.
+ - If [=generate timestamps flag=] equals true and |new mode| equals
{{AppendMode/""segments""}}, then throw a {{TypeError}}
exception and abort these steps.
-
@@ -1167,8 +1167,8 @@
SourceBuffer Object
- If the [=append state=] equals [=PARSING_MEDIA_SEGMENT=], then throw an {{InvalidStateError}} and abort these steps.
- - If the new mode equals {{AppendMode/""sequence""}}, then set the [=group start timestamp=] to the [=group end timestamp=].
- - Update the attribute to new mode.
+ - If the |new mode| equals {{AppendMode/""sequence""}}, then set the [=group start timestamp=] to the [=group end timestamp=].
+ - Update the attribute to |new mode|.
updating
of type {{boolean}}, readonly
Indicates whether the asynchronous continuation of an {{SourceBuffer/appendBuffer()}} or {{SourceBuffer/remove()}}
@@ -1180,20 +1180,20 @@
SourceBuffer Object
When the attribute is read the following steps MUST occur:
- If this object has been removed from the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=] then throw an {{InvalidStateError}} exception and abort these steps.
- - Let highest end time be the largest [=track buffer ranges=] end time across all the [=track buffers=] managed by this SourceBuffer object.
- - Let intersection ranges equal a {{TimeRanges}} object containing a single range from 0 to highest end time.
+ - Let |highest end time:double| be the largest [=track buffer ranges=] end time across all the [=track buffers=] managed by this SourceBuffer object.
+ - Let |intersection ranges:normalized TimeRanges| equal a {{TimeRanges}} object containing a single range from 0 to |highest end time|.
- For each audio and video [=track buffer=] managed by this SourceBuffer, run the following steps:
-
Text [=track buffers=] are included in the calculation of highest end time, above, but excluded from the buffered range calculation here. They are not necessarily continuous, nor should any discontinuity within them trigger playback stall when the other media tracks are continuous over the same time range.
+ Text [=track buffers=] are included in the calculation of |highest end time|, above, but excluded from the buffered range calculation here. They are not necessarily continuous, nor should any discontinuity within them trigger playback stall when the other media tracks are continuous over the same time range.
- - Let track ranges equal the [=track buffer ranges=] for the current [=track buffer=].
- - If {{MediaSource/readyState}} is {{ReadyState/""ended""}}, then set the end time on the last range in track ranges to highest end time.
- - Let new intersection ranges equal the intersection between the intersection ranges and the track ranges.
- - Replace the ranges in intersection ranges with the new intersection ranges.
+ - Let |track ranges:normalized TimeRanges| equal the [=track buffer ranges=] for the current [=track buffer=].
+ - If {{MediaSource/readyState}} is {{ReadyState/""ended""}}, then set the end time on the last range in |track ranges| to |highest end time|.
+ - Let |new intersection ranges:normalized TimeRanges| equal the intersection between the |intersection ranges| and the |track ranges|.
+ - Replace the ranges in |intersection ranges| with the |new intersection ranges|.
- - If intersection ranges does not contain the exact same range information as the
+
- If |intersection ranges| does not contain the exact same range information as the
current value of this attribute, then update the current value of this attribute to
- intersection ranges.
+ |intersection ranges|.
- Return the current value of this attribute.
timestampOffset
of type {{double}}
@@ -1201,7 +1201,7 @@ SourceBuffer Object
On getting, Return the initial value or the last value that was successfully set.
On setting, run the following steps:
- - Let new timestamp offset equal the new value being assigned to this attribute.
+ - Let |new timestamp offset:double| equal the new value being assigned to this attribute.
- If this object has been removed from the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=], then throw an {{InvalidStateError}} exception and abort these steps.
- If the {{SourceBuffer/updating}} attribute equals true, then throw an {{InvalidStateError}} exception and abort these steps.
-
@@ -1212,8 +1212,8 @@
SourceBuffer Object
If the [=append state=] equals [=PARSING_MEDIA_SEGMENT=], then throw an {{InvalidStateError}} and abort these steps.
- If the {{SourceBuffer/mode}} attribute equals {{AppendMode/""sequence""}}, then set the [=group start timestamp=] to new timestamp offset.
- Update the attribute to new timestamp offset.
+ If the {{SourceBuffer/mode}} attribute equals {{AppendMode/""sequence""}}, then set the [=group start timestamp=] to |new timestamp offset|.
+ Update the attribute to |new timestamp offset|.
audioTracks
of type {{AudioTrackList}}, readonly
The list of {{AudioTrack}} objects created by this object.
@@ -1257,16 +1257,16 @@ SourceBuffer Object
onabort
of type {{EventHandler}}
The event handler for the {{abort}} event.
Methods
appendBuffer
-
-
Appends the segment data in an BufferSource[[!WEBIDL]] to the source buffer.
+ Appends the segment data in an BufferSource[[!WEBIDL]] to the {{SourceBuffer}}.
- Run the [=prepare append=] algorithm.
- - Add data to the end of the [=input buffer=].
+ - Add |data:BufferSource| to the end of the [=input buffer=].
- Set the {{SourceBuffer/updating}} attribute to true.
- [=Queue a task=] to [=fire an event=] named {{updatestart}} at this SourceBuffer object.
- Asynchronously run the [=buffer append=] algorithm.
- Parameter | Type | Nullable | Optional | Description |
---|
data | {{BufferSource}} | ✘ | ✘ | |
Return type: {{undefined}}
abort
-
+
Parameter | Type | Nullable | Optional | Description |
---|
|data| | {{BufferSource}} | ✘ | ✘ | |
Return type: {{undefined}}
abort
-
Aborts the current segment and resets the segment parser.
@@ -1289,10 +1289,10 @@ SourceBuffer Object
changeType
-
Changes the MIME type associated with this object. Subsequent {{SourceBuffer/appendBuffer()}} calls will expect the newly appended bytes to conform to the new type.
- - If type is an empty string then throw a {{TypeError}} exception and abort these steps.
+ - If |type:DOMString| is an empty string then throw a {{TypeError}} exception and abort these steps.
- If this object has been removed from the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=], then throw an {{InvalidStateError}} exception and abort these steps.
- If the {{SourceBuffer/updating}} attribute equals true, then throw an {{InvalidStateError}} exception and abort these steps.
- - If type contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified (currently or previously) of {{SourceBuffer}} objects in the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=], then throw a {{NotSupportedError}} exception and abort these steps.
+ - If |type| contains a MIME type that is not supported or contains a MIME type that is not supported with the types specified (currently or previously) of {{SourceBuffer}} objects in the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=], then throw a {{NotSupportedError}} exception and abort these steps.
-
If the {{MediaSource/readyState}} attribute of the [=parent media source=] is in the {{ReadyState/""ended""}} state then run the following steps:
@@ -1303,7 +1303,7 @@ SourceBuffer Object
- Run the [=reset parser state=] algorithm.
- Update the [=generate timestamps flag=] on this {{SourceBuffer}} object to the value in the
"Generate Timestamps Flag" column of the byte stream format registry [[MSE-REGISTRY]] entry
- that is associated with type.
+ that is associated with |type|.
-
- If the [=generate timestamps flag=] equals true:
@@ -1328,7 +1328,7 @@ SourceBuffer Object
Description |
- type |
+ |type| |
{{DOMString}} |
✘ |
✘ |
@@ -1343,8 +1343,8 @@ SourceBuffer Object
- If this object has been removed from the {{MediaSource/sourceBuffers}} attribute of the [=parent media source=] then throw an {{InvalidStateError}} exception and abort these steps.
- If the {{SourceBuffer/updating}} attribute equals true, then throw an {{InvalidStateError}} exception and abort these steps.
- If {{MediaSource/duration}} equals NaN, then throw a {{TypeError}} exception and abort these steps.
- - If start is negative or greater than {{MediaSource/duration}}, then throw a {{TypeError}} exception and abort these steps.
- - If end is less than or equal to start or end equals NaN, then throw a {{TypeError}} exception and abort these steps.
+ - If |start:double| is negative or greater than {{MediaSource/duration}}, then throw a {{TypeError}} exception and abort these steps.
+ - If |end:unrestricted double| is less than or equal to |start| or |end| equals NaN, then throw a {{TypeError}} exception and abort these steps.
-
If the {{MediaSource/readyState}} attribute of the [=parent media source=] is in the {{ReadyState/""ended""}} state then run
the following steps:
@@ -1353,7 +1353,7 @@ SourceBuffer Object
- [=Queue a task=] to [=fire an event=] named {{sourceopen}} at the [=parent media source=].
- - Run the [=range removal=] algorithm with start and end as the start and end of the removal range.
+ - Run the [=range removal=] algorithm with |start| and |end| as the start and end of the removal range.
@@ -1366,7 +1366,7 @@ SourceBuffer Object
Description |
- start |
+ |start| |
{{double}} |
✘ |
@@ -1375,7 +1375,7 @@ SourceBuffer Object
The start of the removal range, in seconds measured from [=presentation start time=]. |
- end |
+ |end| |
{{unrestricted double}} |
✘ |
@@ -1649,12 +1649,12 @@ Range Removal
Follow these steps when a caller needs to initiate a JavaScript visible range removal
operation that blocks other SourceBuffer updates:
- - Let start equal the starting [=presentation timestamp=] for the removal range, in seconds measured from [=presentation start time=].
- - Let end equal the end [=presentation timestamp=] for the removal range, in seconds measured from [=presentation start time=].
+ - Let |start:double| equal the starting [=presentation timestamp=] for the removal range, in seconds measured from [=presentation start time=].
+ - Let |end:unrestricted double| equal the end [=presentation timestamp=] for the removal range, in seconds measured from [=presentation start time=].
- Set the {{SourceBuffer/updating}} attribute to true.
- [=Queue a task=] to [=fire an event=] named {{updatestart}} at this SourceBuffer object.
- Return control to the caller and run the rest of the steps asynchronously.
- - Run the [=coded frame removal=] algorithm with start and end as the start and end of the removal range.
+ - Run the [=coded frame removal=] algorithm with |start| and |end| as the start and end of the removal range.
- Set the {{SourceBuffer/updating}} attribute to false.
- [=Queue a task=] to [=fire an event=] named {{update}} at this SourceBuffer object.
- [=Queue a task=] to [=fire an event=] named {{updateend}} at this SourceBuffer object.
@@ -1674,7 +1674,8 @@ Initialization Segment Received
- Update the {{MediaSource/duration}} attribute if it currently equals NaN:
- If the initialization segment contains a duration:
- - Run the [=duration change=] algorithm with |new duration| set to the duration in the initialization segment.
+ - Run the [=duration change=] algorithm with |new duration:unrestricted double| set to the duration in
+ the initialization segment.
- Otherwise:
- Run the [=duration change=] algorithm with |new duration| set to positive Infinity.
@@ -1689,7 +1690,7 @@ Initialization Segment Received
first [=initialization segment=].
- The codecs for each track are supported by the user agent.
User agents MAY consider codecs, that would otherwise be supported, as "not supported" here if the codecs were not
- specified in type parameter passed to
+ specified in |type:DOMString| parameter passed to
(a) the most recently successful {{SourceBuffer/changeType()}} on this {{SourceBuffer}} object, or
(b) if no successful {{SourceBuffer/changeType()}} has yet occurred on this object, the {{MediaSource/addSourceBuffer()}}
that created this {{SourceBuffer}} object.
@@ -1717,7 +1718,7 @@
Initialization Segment Received
- If the [=initialization segment=] contains tracks with codecs the user agent does not support, then run the [=append error=] algorithm and abort these steps.
User agents MAY consider codecs, that would otherwise be supported, as "not supported" here if the codecs were not
- specified in type parameter passed to
+ specified in |type:DOMString| parameter passed to
(a) the most recently successful {{SourceBuffer/changeType()}} on this {{SourceBuffer}} object, or
(b) if no successful {{SourceBuffer/changeType()}} has yet occurred on this object, the {{MediaSource/addSourceBuffer()}}
that created this {{SourceBuffer}} object.
@@ -1734,30 +1735,30 @@
Initialization Segment Received
-
For each audio track in the [=initialization segment=], run following steps:
- - Let audio byte stream track ID be the
+
- Let |audio byte stream track ID| be the
[=Track ID=] for the current track being processed.
- - Let audio language be a BCP 47 language tag for the language
+
- Let |audio language:DOMString| be a BCP 47 language tag for the language
specified in the [=initialization segment=] for this track or an empty string if no
language info is present.
- - If audio language equals the 'und' BCP 47 value, then assign an empty string to audio language.
- - Let audio label be a label specified in the [=initialization segment=] for this track or an empty string if no
+
- If |audio language| equals the 'und' BCP 47 value, then assign an empty string to |audio language|.
+ - Let |audio label:DOMString| be a label specified in the [=initialization segment=] for this track or an empty string if no
label info is present.
- - Let audio kinds be a sequence of kind strings specified in the
+
- Let |audio kinds:DOMString sequence| be a sequence of kind strings specified in the
[=initialization segment=] for this track
or a sequence with a single empty string element in it
if no kind information is provided.
- - For each value in audio kinds, run the following steps:
+
- For each value in |audio kinds|, run the following steps:
- - Let current audio kind equal the value from audio kinds
+
- Let |current audio kind:DOMString| equal the value from |audio kinds|
for this iteration of the loop.
- Let |new audio track:AudioTrack| be a new {{AudioTrack}} object.
- Generate a unique ID and assign it to the property on
|new audio track|.
- - Assign audio language to the
+
- Assign |audio language| to the
property on |new audio track|.
- - Assign audio label to the
+
- Assign |audio label| to the
property on |new audio track|.
- - Assign current audio kind to the
+
- Assign |current audio kind| to the
property on |new audio track|.
-
@@ -1808,30 +1809,30 @@
Initialization Segment Received
-
For each video track in the [=initialization segment=], run following steps:
- - Let video byte stream track ID be the
+
- Let |video byte stream track ID| be the
[=Track ID=] for the current track being processed.
- - Let video language be a BCP 47 language tag for the language
+
- Let |video language:DOMString| be a BCP 47 language tag for the language
specified in the [=initialization segment=] for this track or an empty string if no
language info is present.
- - If video language equals the 'und' BCP 47 value, then assign an empty string to video language.
- - Let video label be a label specified in the [=initialization segment=] for this track or an empty string if no
+
- If |video language| equals the 'und' BCP 47 value, then assign an empty string to |video language|.
+ - Let |video label:DOMString| be a label specified in the [=initialization segment=] for this track or an empty string if no
label info is present.
- - Let video kinds be a sequence of kind strings specified in the
+
- Let |video kinds:DOMString sequence| be a sequence of kind strings specified in the
[=initialization segment=] for this track
or a sequence with a single empty string element in it
if no kind information is provided.
- - For each value in video kinds, run the following steps:
+
- For each value in |video kinds|, run the following steps:
- - Let current video kind equal the value from video kinds
+
- Let |current video kind:DOMString| equal the value from |video kinds|
for this iteration of the loop.
- Let |new video track:VideoTrack| be a new {{VideoTrack}} object.
- Generate a unique ID and assign it to the {{VideoTrack/id}} property on
|new video track|.
- - Assign video language to the {{VideoTrack/language}}
+
- Assign |video language| to the {{VideoTrack/language}}
property on |new video track|.
- - Assign video label to the {{VideoTrack/label}}
+
- Assign |video label| to the {{VideoTrack/label}}
property on |new video track|.
- - Assign current video kind to the {{VideoTrack/kind}}
+
- Assign |current video kind| to the {{VideoTrack/kind}}
property on |new video track|.
-
@@ -1882,30 +1883,30 @@
Initialization Segment Received
-
For each text track in the [=initialization segment=], run following steps:
- - Let text byte stream track ID be the
+
- Let |text byte stream track ID| be the
[=Track ID=] for the current track being processed.
- - Let text language be a BCP 47 language tag for the language
+
- Let |text language:DOMString| be a BCP 47 language tag for the language
specified in the [=initialization segment=] for this track or an empty string if no
language info is present.
- - If text language equals the 'und' BCP 47 value, then assign an empty string to text language.
- - Let text label be a label specified in the [=initialization segment=] for this track or an empty string if no
+
- If |text language| equals the 'und' BCP 47 value, then assign an empty string to |text language|.
+ - Let |text label:DOMString| be a label specified in the [=initialization segment=] for this track or an empty string if no
label info is present.
- - Let text kinds be a sequence of kind strings specified in the
+
- Let |text kinds:DOMString sequence| be a sequence of kind strings specified in the
[=initialization segment=] for this track
or a sequence with a single empty string element in it
if no kind information is provided.
- - For each value in text kinds, run the following steps:
+
- For each value in |text kinds|, run the following steps:
- - Let current text kind equal the value from text kinds
+
- Let |current text kind:DOMString| equal the value from |text kinds|
for this iteration of the loop.
- Let |new text track:TextTrack| be a new {{TextTrack}} object.
- Generate a unique ID and assign it to the {{TextTrack/id}} property on
|new text track|.
- - Assign text language to the {{TextTrack/language}}
+
- Assign |text language| to the {{TextTrack/language}}
property on |new text track|.
- - Assign text label to the {{TextTrack/label}}
+
- Assign |text label| to the {{TextTrack/label}}
property on |new text track|.
- - Assign current text kind to the {{TextTrack/kind}}
+
- Assign |current text kind| to the {{TextTrack/kind}}
property on |new text track|.
- Populate the remaining properties on |new text track| with the
appropriate information from the [=initialization segment=].
@@ -2020,19 +2021,19 @@ Coded Frame Processing
- If [=generate timestamps flag=] equals true:
-
- - Let presentation timestamp equal 0.
- - Let decode timestamp equal 0.
+ - Let |presentation timestamp:double| equal 0.
+ - Let |decode timestamp:double| equal 0.
- Otherwise:
-
- - Let presentation timestamp be a double precision floating point representation of the coded frame's [=presentation timestamp=] in seconds.
+
- Let |presentation timestamp| be a double precision floating point representation of the coded frame's [=presentation timestamp=] in seconds.
Special processing may be needed to determine the presentation and decode timestamps for timed text frames since this information may not be explicitly
present in the underlying format or may be dependent on the order of the frames. Some metadata text tracks, like MPEG2-TS PSI data, may only have implied timestamps.
Format specific rules for these situations SHOULD be in the [=byte stream format specifications=] or in separate extension specifications.
- - Let decode timestamp be a double precision floating point representation of the coded frame's decode timestamp in seconds.
+
- Let |decode timestamp| be a double precision floating point representation of the coded frame's decode timestamp in seconds.
Implementations don't have to internally store timestamps in a double precision floating point representation. This
representation is used here because it is the representation for timestamps in the HTML spec. The intention here is to make the
behavior clear without adding unnecessary complexity to the algorithm to deal with the fact that adding a timestampOffset may
@@ -2045,10 +2046,10 @@
Coded Frame Processing
- - Let frame duration be a double precision floating point representation of the [=coded frame duration|coded frame's duration=] in seconds.
+ - Let |frame duration:double| be a double precision floating point representation of the [=coded frame duration|coded frame's duration=] in seconds.
- If {{SourceBuffer/mode}} equals {{AppendMode/""sequence""}} and [=group start timestamp=] is set, then run the following steps:
- - Set {{SourceBuffer/timestampOffset}} equal to [=group start timestamp=] - presentation timestamp.
+ - Set {{SourceBuffer/timestampOffset}} equal to [=group start timestamp=] minus |presentation timestamp|.
- Set [=group end timestamp=] equal to [=group start timestamp=].
- Set the [=need random access point flag=] on all [=track buffers=] to true.
- Unset [=group start timestamp=].
@@ -2057,24 +2058,24 @@ Coded Frame Processing
-
If {{SourceBuffer/timestampOffset}} is not 0, then run the following steps:
- - Add {{SourceBuffer/timestampOffset}} to the presentation timestamp.
- - Add {{SourceBuffer/timestampOffset}} to the decode timestamp.
+ - Add {{SourceBuffer/timestampOffset}} to the |presentation timestamp|.
+ - Add {{SourceBuffer/timestampOffset}} to the |decode timestamp|.
- - Let track buffer equal the [=track buffer=] that the coded frame will be added to.
+ - Let |track buffer| equal the [=track buffer=] that the coded frame will be added to.
-
- - If [=last decode timestamp=] for track buffer is set and decode timestamp is less than
+
- If [=last decode timestamp=] for |track buffer| is set and |decode timestamp| is less than
[=last decode timestamp=]:
- OR
- - If [=last decode timestamp=] for track buffer is set and the difference between decode timestamp and [=last decode timestamp=]
+
- If [=last decode timestamp=] for |track buffer| is set and the difference between |decode timestamp| and [=last decode timestamp=]
is greater than 2 times [=last frame duration=]:
-
-
- If {{SourceBuffer/mode}} equals {{AppendMode/""segments""}}:
- - Set [=group end timestamp=] to presentation timestamp.
+ - Set [=group end timestamp=] to |presentation timestamp|.
- If {{SourceBuffer/mode}} equals {{AppendMode/""sequence""}}:
- Set [=group start timestamp=] equal to the [=group end timestamp=].
@@ -2090,45 +2091,45 @@ Coded Frame Processing
- Continue.
- - Let frame end timestamp equal the sum of presentation timestamp and frame duration.
- - If presentation timestamp is less than {{SourceBuffer/appendWindowStart}}, then set the [=need random access point flag=] to true, drop the
+
- Let |frame end timestamp:double| equal the sum of |presentation timestamp| and |frame duration|.
+ - If |presentation timestamp| is less than {{SourceBuffer/appendWindowStart}}, then set the [=need random access point flag=] to true, drop the
coded frame, and jump to the top of the loop to start processing the next coded frame.
-
Some implementations MAY choose to collect some of these coded frames with presentation timestamp less than {{SourceBuffer/appendWindowStart}} and use them
+
Some implementations MAY choose to collect some of these coded frames with |presentation timestamp| less than {{SourceBuffer/appendWindowStart}} and use them
to generate a splice at the first coded frame that has a [=presentation timestamp=] greater than or equal to {{SourceBuffer/appendWindowStart}} even if
that frame is not a [=random access point=]. Supporting this requires multiple decoders or faster than real-time decoding so for now
this behavior will not be a normative requirement.
- - If frame end timestamp is greater than {{SourceBuffer/appendWindowEnd}}, then set the [=need random access point flag=] to true, drop the
+
- If |frame end timestamp| is greater than {{SourceBuffer/appendWindowEnd}}, then set the [=need random access point flag=] to true, drop the
coded frame, and jump to the top of the loop to start processing the next coded frame.
-
Some implementations MAY choose to collect coded frames with presentation timestamp less than {{SourceBuffer/appendWindowEnd}} and frame end timestamp greater than {{SourceBuffer/appendWindowEnd}} and use them
+
Some implementations MAY choose to collect coded frames with |presentation timestamp| less than {{SourceBuffer/appendWindowEnd}} and |frame end timestamp| greater than {{SourceBuffer/appendWindowEnd}} and use them
to generate a splice across the portion of the collected coded frames within the append window at time of collection, and the beginning portion of later processed frames which only partially overlap the end of the collected coded frames.
Supporting this requires multiple decoders or faster than real-time decoding so for now
this behavior will not be a normative requirement.
In conjunction with collecting coded frames that span {{SourceBuffer/appendWindowStart}}, implementations MAY thus support gapless audio splicing.
- - If the [=need random access point flag=] on track buffer equals true, then run the following steps:
+
- If the [=need random access point flag=] on |track buffer| equals true, then run the following steps:
- If the coded frame is not a [=random access point=], then drop the coded frame and jump to the top of the loop to start
processing the next coded frame.
- - Set the [=need random access point flag=] on track buffer to false.
+ - Set the [=need random access point flag=] on |track buffer| to false.
- - Let spliced audio frame be an unset variable for holding audio splice information
- - Let spliced timed text frame be an unset variable for holding timed text splice information
- - If [=last decode timestamp=] for track buffer is unset and presentation timestamp falls within the [=presentation interval=] of a [=coded frame=] in track buffer, then run the following steps:
+
- Let |spliced audio frame| be an unset variable for holding audio splice information
+ - Let |spliced timed text frame| be an unset variable for holding timed text splice information
+ - If [=last decode timestamp=] for |track buffer| is unset and |presentation timestamp| falls within the [=presentation interval=] of a [=coded frame=] in |track buffer|, then run the following steps:
- - Let overlapped frame be the [=coded frame=] in track buffer that matches the condition above.
+ - Let |overlapped frame| be the [=coded frame=] in |track buffer| that matches the condition above.
-
- - If track buffer contains audio [=coded frames=]:
- - Run the [=audio splice frame=] algorithm and if a splice frame is returned, assign it to spliced audio frame.
- - If track buffer contains video [=coded frames=]:
+ - If |track buffer| contains audio [=coded frames=]:
+ - Run the [=audio splice frame=] algorithm and if a splice frame is returned, assign it to |spliced audio frame|.
+ - If |track buffer| contains video [=coded frames=]:
-
- - Let remove window timestamp equal the overlapped frame [=presentation timestamp=] plus 1 microsecond.
- - If the presentation timestamp is less than the remove window timestamp, then remove overlapped frame from track buffer.
+
- Let |remove window timestamp:double| equal the |overlapped frame| [=presentation timestamp=] plus 1 microsecond.
+ - If the |presentation timestamp| is less than the |remove window timestamp|, then remove |overlapped frame| from |track buffer|.
This is to compensate for minor errors in frame timestamp computations that can appear when converting back and forth between double precision
floating point numbers and rationals. This tolerance allows a frame to replace an existing one as long as it is within 1 microsecond of the existing
@@ -2137,24 +2138,24 @@
Coded Frame Processing
- - If track buffer contains timed text [=coded frames=]:
- - Run the [=text splice frame=] algorithm and if a splice frame is returned, assign it to spliced timed text frame.
+ - If |track buffer| contains timed text [=coded frames=]:
+ - Run the [=text splice frame=] algorithm and if a splice frame is returned, assign it to |spliced timed text frame|.
- - Remove existing coded frames in track buffer:
+
- Remove existing coded frames in |track buffer|:
- - If [=highest end timestamp=] for track buffer is not set:
- - Remove all [=coded frames=] from track buffer that have a [=presentation timestamp=] greater than or equal to
- presentation timestamp and less than frame end timestamp.
- - If [=highest end timestamp=] for track buffer is set and less than or equal to presentation timestamp:
- - Remove all [=coded frames=] from track buffer that have a [=presentation timestamp=] greater than
- or equal to [=highest end timestamp=] and less than frame end timestamp
+ - If [=highest end timestamp=] for |track buffer| is not set:
+ - Remove all [=coded frames=] from |track buffer| that have a [=presentation timestamp=] greater than or equal to
+ |presentation timestamp| and less than |frame end timestamp|.
+ - If [=highest end timestamp=] for |track buffer| is set and less than or equal to |presentation timestamp|:
+ - Remove all [=coded frames=] from |track buffer| that have a [=presentation timestamp=] greater than
+ or equal to [=highest end timestamp=] and less than |frame end timestamp|.
- Remove all possible decoding dependencies on the [=coded frames=] removed in the previous two steps
- by removing all [=coded frames=] from track buffer between those frames removed in the previous two steps and the next
+ by removing all [=coded frames=] from |track buffer| between those frames removed in the previous two steps and the next
[=random access point=] after those removed frames.
Removing all [=coded frames=] until the next [=random access point=] is a conservative
estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
@@ -2163,26 +2164,26 @@
Coded Frame Processing
-
- - If spliced audio frame is set:
- - Add spliced audio frame to the track buffer.
- - If spliced timed text frame is set:
- - Add spliced timed text frame to the track buffer.
+ - If |spliced audio frame| is set:
+ - Add |spliced audio frame| to the |track buffer|.
+ - If |spliced timed text frame| is set:
+ - Add |spliced timed text frame| to the |track buffer|.
- Otherwise:
- - Add the [=coded frame=] with the presentation timestamp, decode timestamp, and frame duration to the
- track buffer.
+ - Add the [=coded frame=] with the |presentation timestamp|, |decode timestamp|, and |frame duration| to the
+ |track buffer|.
- - Set [=last decode timestamp=] for track buffer to decode timestamp.
- - Set [=last frame duration=] for track buffer to frame duration.
- - If [=highest end timestamp=] for track buffer is unset or frame end timestamp is greater
- than [=highest end timestamp=], then set [=highest end timestamp=] for track buffer
- to frame end timestamp.
+
- Set [=last decode timestamp=] for |track buffer| to |decode timestamp|.
+ - Set [=last frame duration=] for |track buffer| to |frame duration|.
+ - If [=highest end timestamp=] for |track buffer| is unset or |frame end timestamp| is greater
+ than [=highest end timestamp=], then set [=highest end timestamp=] for |track buffer|
+ to |frame end timestamp|.
The greater than check is needed because bidirectional prediction between coded frames can cause
- presentation timestamp to not be monotonically increasing even though the decode timestamps are monotonically increasing.
+ |presentation timestamp| to not be monotonically increasing even though the decode timestamps are monotonically increasing.
- - If frame end timestamp is greater than [=group end timestamp=],
- then set [=group end timestamp=] equal to frame end timestamp.
+ - If |frame end timestamp| is greater than [=group end timestamp=],
+ then set [=group end timestamp=] equal to |frame end timestamp|.
- If [=generate timestamps flag=] equals true, then set
- {{SourceBuffer/timestampOffset}} equal to frame end timestamp.
+ {{SourceBuffer/timestampOffset}} equal to |frame end timestamp|.
-
@@ -2198,7 +2199,8 @@
Coded Frame Processing
Per [[HTML]] logic, {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} changes may trigger events on the HTMLMediaElement.
- If the [=media segment=] contains data beyond the current {{MediaSource/duration}}, then run the
- [=duration change=] algorithm with |new duration| set to the maximum of the current duration and the [=group end timestamp=].
+ [=duration change=] algorithm with |new duration:unrestricted double| set to the maximum of the current
+ duration and the [=group end timestamp=].
@@ -2206,18 +2208,18 @@ Coded Frame Processing
Coded Frame Removal
Follow these steps when [=coded frames=] for a specific time range need to be removed from the SourceBuffer:
- - Let start be the starting [=presentation timestamp=] for the removal range.
- - Let end be the end [=presentation timestamp=] for the removal range.
- For each [=track buffer=] in this source buffer, run the following steps:
+ - Let |start:double| be the starting [=presentation timestamp=] for the removal range.
+ - Let |end:unrestricted double| be the end [=presentation timestamp=] for the removal range.
+ For each [=track buffer=] in this {{SourceBuffer}}, run the following steps:
- - Let remove end timestamp be the current value of {{MediaSource/duration}}
+ - Let |remove end timestamp:unrestricted double| be the current value of {{MediaSource/duration}}
-
If this [=track buffer=] has a [=random access point=] timestamp that is greater than or equal to
- end, then update remove end timestamp to that random access point timestamp.
+ |end|, then update |remove end timestamp| to that random access point timestamp.
Random access point timestamps can be different across tracks because the dependencies between [=coded frames=] within a
track are usually different than the dependencies in another track.
- - Remove all media data, from this [=track buffer=], that contain starting timestamps greater than or equal to start and less than the remove end timestamp.
+
- Remove all media data, from this [=track buffer=], that contain starting timestamps greater than or equal to |start| and less than the |remove end timestamp|.
For each removed frame, if the frame has a [=decode timestamp=] equal to the [=last decode timestamp=] for the frame's track, run the following steps:
@@ -2243,7 +2245,7 @@ Coded Frame Removal
-
If this object is in {{MediaSource/activeSourceBuffers}}, the is greater than or equal to
- start and less than the remove end timestamp, and {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} is greater than
+ |start| and less than the |remove end timestamp|, and {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} is greater than
, then set the {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} attribute to and stall playback.
Per [[HTML]] logic, {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} changes may trigger events on the HTMLMediaElement.
This transition occurs because media data for the current position has been removed. Playback cannot progress until media for the
@@ -2258,17 +2260,17 @@
Coded Frame Removal
Coded Frame Eviction
- This algorithm is run to free up space in this source buffer when new data is appended.
+ This algorithm is run to free up space in this {{SourceBuffer}} when new data is appended.
- - Let new data equal the data that is about to be appended to this SourceBuffer.
+ - Let |new data:BufferSource| equal the data that is about to be appended to this SourceBuffer.
- If the [=buffer full flag=] equals false, then abort these steps.
- - Let removal ranges equal a list of presentation time ranges that can be evicted from the presentation to make room for the
- new data.
-
Implementations MAY use different methods for selecting removal ranges so web applications SHOULD NOT depend on a
+
- Let |removal ranges:normalized TimeRanges| equal a list of presentation time ranges that can be evicted from the presentation to make room for the
+ |new data|.
+
Implementations MAY use different methods for selecting |removal ranges| so web applications SHOULD NOT depend on a
specific behavior. The web application can use the {{SourceBuffer/buffered}} attribute to observe whether portions of the buffered data have been evicted.
- - For each range in removal ranges, run the [=coded frame removal=] algorithm with start and end equal to
+
- For each range in |removal ranges|, run the [=coded frame removal=] algorithm with |start:double| and |end:unrestricted double| equal to
the removal range start and end timestamp respectively.
@@ -2278,36 +2280,36 @@ Audio Splice Frame
Follow these steps when the [=coded frame processing=] algorithm needs to generate a splice frame for two overlapping audio
[=coded frames=]:
- - Let track buffer be the [=track buffer=] that will contain the splice.
- - Let new coded frame be the new [=coded frame=], that is being added to track buffer, which triggered the need for a splice.
- - Let presentation timestamp be the [=presentation timestamp=] for new coded frame
- - Let decode timestamp be the decode timestamp for new coded frame.
- - Let frame duration be the [=coded frame duration=] of new coded frame.
- - Let overlapped frame be the [=coded frame=] in track buffer with a [=presentation interval=] that contains presentation timestamp.
+
- Let |track buffer| be the [=track buffer=] that will contain the splice.
+ - Let |new coded frame| be the new [=coded frame=], that is being added to |track buffer|, which triggered the need for a splice.
+ - Let |presentation timestamp:double| be the [=presentation timestamp=] for |new coded frame|.
+ - Let |decode timestamp:double| be the decode timestamp for |new coded frame|.
+ - Let |frame duration:double| be the [=coded frame duration=] of |new coded frame|.
+ - Let |overlapped frame| be the [=coded frame=] in |track buffer| with a [=presentation interval=] that contains |presentation timestamp|.
- - Update presentation timestamp and decode timestamp to the nearest audio sample timestamp based on sample rate of the
- audio in overlapped frame. If a timestamp is equidistant from both audio sample timestamps, then use the higher timestamp (e.g.,
+
- Update |presentation timestamp| and |decode timestamp| to the nearest audio sample timestamp based on sample rate of the
+ audio in |overlapped frame|. If a timestamp is equidistant from both audio sample timestamps, then use the higher timestamp (e.g.,
floor(x * sample_rate + 0.5) / sample_rate
).
For example, given the following values:
- - The [=presentation timestamp=] of overlapped frame equals 10.
- - The sample rate of overlapped frame equals 8000 Hz
- - presentation timestamp equals 10.01255
- - decode timestamp equals 10.01255
+ - The [=presentation timestamp=] of |overlapped frame| equals 10.
+ - The sample rate of |overlapped frame| equals 8000 Hz
+ - |presentation timestamp| equals 10.01255
+ - |decode timestamp| equals 10.01255
-
presentation timestamp and decode timestamp are updated to 10.0125 since 10.01255 is closer to
+
|presentation timestamp| and |decode timestamp| are updated to 10.0125 since 10.01255 is closer to
10 + 100/8000 (10.0125) than 10 + 101/8000 (10.012625)
- If the user agent does not support crossfading then run the following steps:
- - Remove overlapped frame from track buffer.
- - Add a silence frame to track buffer with the following properties:
+
- Remove |overlapped frame| from |track buffer|.
+ - Add a silence frame to |track buffer| with the following properties:
- - The [=presentation timestamp=] set to the overlapped frame [=presentation timestamp=].
- - The [=decode timestamp=] set to the overlapped frame [=decode timestamp=].
- - The [=coded frame duration=] set to difference between presentation timestamp and the overlapped frame [=presentation timestamp=].
+ - The [=presentation timestamp=] set to the |overlapped frame| [=presentation timestamp=].
+ - The [=decode timestamp=] set to the |overlapped frame| [=decode timestamp=].
+ - The [=coded frame duration=] set to difference between |presentation timestamp| and the |overlapped frame| [=presentation timestamp=].
Some implementations MAY apply fades to/from silence to coded frames on either side of the inserted silence to make the transition less
@@ -2316,28 +2318,28 @@
Audio Splice Frame
- Return to caller without providing a splice frame.
- This is intended to allow new coded frame to be added to the track buffer as if
- overlapped frame had not been in the track buffer to begin with.
+ This is intended to allow |new coded frame| to be added to the |track buffer| as if
+ |overlapped frame| had not been in the |track buffer| to begin with.
- - Let frame end timestamp equal the sum of presentation timestamp and frame duration.
- - Let splice end timestamp equal the sum of presentation timestamp and the splice duration of 5 milliseconds.
- - Let fade out coded frames equal overlapped frame as well as any additional frames in track buffer that
- have a [=presentation timestamp=] greater than presentation timestamp and less than splice end timestamp.
- - Remove all the frames included in fade out coded frames from track buffer.
+
- Let |frame end timestamp:double| equal the sum of |presentation timestamp| and |frame duration|.
+ - Let |splice end timestamp:double| equal the sum of |presentation timestamp| and the splice duration of 5 milliseconds.
+ - Let |fade out coded frames| equal |overlapped frame| as well as any additional frames in |track buffer| that
+ have a [=presentation timestamp=] greater than |presentation timestamp| and less than |splice end timestamp|.
+ - Remove all the frames included in |fade out coded frames| from |track buffer|.
- Return a splice frame with the following properties:
- - The [=presentation timestamp=] set to the overlapped frame [=presentation timestamp=].
- - The [=decode timestamp=] set to the overlapped frame [=decode timestamp=].
- - The [=coded frame duration=] set to difference between frame end timestamp and the overlapped frame [=presentation timestamp=].
- - The fade out coded frames equals fade-out coded frames.
- - The fade in coded frame equal new coded frame.
-
If the new coded frame is less than 5 milliseconds in duration, then coded frames that are appended after the
- new coded frame will be needed to properly render the splice.
+ - The [=presentation timestamp=] set to the |overlapped frame| [=presentation timestamp=].
+ - The [=decode timestamp=] set to the |overlapped frame| [=decode timestamp=].
+ - The [=coded frame duration=] set to difference between |frame end timestamp| and the |overlapped frame| [=presentation timestamp=].
+ - The fade out coded frames equals |fade out coded frames|.
+ - The fade in coded frame equals |new coded frame|.
+
If the |new coded frame| is less than 5 milliseconds in duration, then coded frames that are appended after the
+ |new coded frame| will be needed to properly render the splice.
- - The splice timestamp equals presentation timestamp.
+ - The splice timestamp equals |presentation timestamp|.
See the [=audio splice rendering=] algorithm for details on how this splice frame is rendered.
@@ -2348,28 +2350,28 @@ Audio Splice Rendering
The following steps are run when a spliced frame, generated by the [=audio splice frame=] algorithm, needs to be rendered by the
media element:
- - Let fade out coded frames be the [=coded frames=] that are faded out during the splice.
- - Let fade in coded frames be the [=coded frames=] that are faded in during the splice.
- - Let presentation timestamp be the [=presentation timestamp=] of the first coded frame in fade out coded frames.
- - Let end timestamp be the sum of the [=presentation timestamp=] and the [=coded frame duration=] of the last frame in fade in coded frames.
- - Let splice timestamp be the [=presentation timestamp=] where the splice starts. This corresponds with the [=presentation timestamp=] of the first frame in
- fade in coded frames.
- - Let splice end timestamp equal splice timestamp plus five milliseconds.
- - Let fade out samples be the samples generated by decoding fade out coded frames.
- - Trim fade out samples so that it only contains samples between presentation timestamp and splice end timestamp.
- - Let fade in samples be the samples generated by decoding fade in coded frames.
- - If fade out samples and fade in samples do not have a common sample rate and channel layout, then convert
- fade out samples and fade in samples to a common sample rate and channel layout.
- - Let output samples be a buffer to hold the output samples.
+ - Let |fade out coded frames| be the [=coded frames=] that are faded out during the splice.
+ - Let |fade in coded frames| be the [=coded frames=] that are faded in during the splice.
+ - Let |presentation timestamp:double| be the [=presentation timestamp=] of the first coded frame in |fade out coded frames|.
+ - Let |end timestamp:double| be the sum of the [=presentation timestamp=] and the [=coded frame duration=] of the last frame in |fade in coded frames|.
+ - Let |splice timestamp:double| be the [=presentation timestamp=] where the splice starts. This corresponds with the [=presentation timestamp=] of the first frame in
+ |fade in coded frames|.
+ - Let |splice end timestamp:double| equal |splice timestamp| plus five milliseconds.
+ - Let |fade out samples| be the samples generated by decoding |fade out coded frames|.
+ - Trim |fade out samples| so that it only contains samples between |presentation timestamp| and |splice end timestamp|.
+ - Let |fade in samples| be the samples generated by decoding |fade in coded frames|.
+ - If |fade out samples| and |fade in samples| do not have a common sample rate and channel layout, then convert
+ |fade out samples| and |fade in samples| to a common sample rate and channel layout.
+ - Let |output samples| be a buffer to hold the output samples.
- Apply a linear gain fade out with a starting gain of 1 and an ending gain of 0 to the samples between
- splice timestamp and splice end timestamp in fade out samples.
- - Apply a linear gain fade in with a starting gain of 0 and an ending gain of 1 to the samples between splice timestamp and
- splice end timestamp in fade in samples.
- - Copy samples between presentation timestamp to splice timestamp from fade out samples into output samples.
- - For each sample between splice timestamp and splice end timestamp, compute the sum of a sample from fade out samples and the
- corresponding sample in fade in samples and store the result in output samples.
- - Copy samples between splice end timestamp to end timestamp from fade in samples into output samples.
- - Render output samples.
+ |splice timestamp| and |splice end timestamp| in |fade out samples|.
+ - Apply a linear gain fade in with a starting gain of 0 and an ending gain of 1 to the samples between |splice timestamp| and
+ |splice end timestamp| in |fade in samples|.
+ - Copy samples between |presentation timestamp| to |splice timestamp| from |fade out samples| into |output samples|.
+ - For each sample between |splice timestamp| and |splice end timestamp|, compute the sum of a sample from |fade out samples| and the
+ corresponding sample in |fade in samples| and store the result in |output samples|.
+ - Copy samples between |splice end timestamp| to |end timestamp| from |fade in samples| into |output samples|.
+ - Render |output samples|.
Here is a graphical representation of this algorithm.
@@ -2381,23 +2383,23 @@
Text Splice Frame
Follow these steps when the [=coded frame processing=] algorithm needs to generate a splice frame for two overlapping timed text
[=coded frames=]:
- - Let track buffer be the [=track buffer=] that will contain the splice.
- - Let new coded frame be the new [=coded frame=], that is being added to track buffer, which triggered the need for a splice.
- - Let presentation timestamp be the [=presentation timestamp=] for new coded frame
- - Let decode timestamp be the decode timestamp for new coded frame.
- - Let frame duration be the [=coded frame duration=] of new coded frame.
- - Let frame end timestamp equal the sum of presentation timestamp and frame duration.
- - Let first overlapped frame be the [=coded frame=] in track buffer with a [=presentation interval=] that contains presentation timestamp.
+
- Let |track buffer| be the [=track buffer=] that will contain the splice.
+ - Let |new coded frame| be the new [=coded frame=], that is being added to |track buffer|, which triggered the need for a splice.
+ - Let |presentation timestamp:double| be the [=presentation timestamp=] for |new coded frame|
+ - Let |decode timestamp:double| be the decode timestamp for |new coded frame|.
+ - Let |frame duration:double| be the [=coded frame duration=] of |new coded frame|.
+ - Let |frame end timestamp:double| equal the sum of |presentation timestamp| and |frame duration|.
+ - Let |first overlapped frame| be the [=coded frame=] in |track buffer| with a [=presentation interval=] that contains |presentation timestamp|.
- - Let overlapped presentation timestamp be the [=presentation timestamp=] of the first overlapped frame.
- - Let overlapped frames equal first overlapped frame as well as any additional frames in track buffer that
- have a [=presentation timestamp=] greater than presentation timestamp and less than frame end timestamp.
- - Remove all the frames included in overlapped frames from track buffer.
-
- Update the [=coded frame duration=] of the first overlapped frame to presentation timestamp - overlapped presentation timestamp.
- - Add first overlapped frame to the track buffer.
+
- Let |overlapped presentation timestamp:double| be the [=presentation timestamp=] of the |first overlapped frame|.
+ - Let |overlapped frames| equal |first overlapped frame| as well as any additional frames in |track buffer| that
+ have a [=presentation timestamp=] greater than |presentation timestamp| and less than |frame end timestamp|.
+ - Remove all the frames included in |overlapped frames| from |track buffer|.
+
- Update the [=coded frame duration=] of the |first overlapped frame| to |presentation timestamp| minus |overlapped presentation timestamp|.
+ - Add |first overlapped frame| to the |track buffer|.
- Return to caller without providing a splice frame.
-
This is intended to allow new coded frame to be added to the track buffer as if
- it hadn't overlapped any frames in track buffer to begin with.
+ This is intended to allow |new coded frame| to be added to the |track buffer| as if
+ it hadn't overlapped any frames in |track buffer| to begin with.
@@ -2439,14 +2441,14 @@
Methods
Allows the SourceBuffer objects in the list to be accessed with an array operator (i.e., []).
- - If index is greater than or equal to the {{SourceBufferList/length}} attribute then return undefined and abort these steps.
- - Return the index'th SourceBuffer object in the list.
+ - If |index:unsigned long| is greater than or equal to the {{SourceBufferList/length}} attribute then return undefined and abort these steps.
+ - Return the |index|'th SourceBuffer object in the list.
Parameter | Type | Nullable | Optional | Description |
- index |
+ |index| |
{{unsigned long}} |
✘ |
✘ |