Fading, seeking, and decode dependency clarifications.
authorAaron Colwell <acolwell@google.com>
Mon, 08 Apr 2013 12:40:25 -0700
changeset 96f7f2b7226543
parent 95 575c617be722
child 97 c2eefcfba41c
Fading, seeking, and decode dependency clarifications.

Bug 21327 - Crossfade clarifications.
Bug 21334 - Clarified seeking behavoir.
Bug 21326 - Add a note stating some implementations may choose to add fades to/from silence.
Bug 21375 - Clarified decode dependency removal.
Bug 21376 - Replace 100ms limit with 2x last frame duration limit.
media-source/media-source-respec.html
media-source/media-source.html
media-source/media-source.js
     1.1 --- a/media-source/media-source-respec.html	Thu Mar 28 09:58:23 2013 -0700
     1.2 +++ b/media-source/media-source-respec.html	Mon Apr 08 12:40:25 2013 -0700
     1.3 @@ -160,20 +160,27 @@
     1.4            <dd><p>A unit of compressed media data that has a presentation timestamp and  decode timestamp. The presentation timestamp indicates when the frame should be rendered. The decode timestamp indicates when the frame needs to be decoded. If frames can be decoded out of order, then the decode timestamp must be present in the bytestream. If frames cannot be decoded out of order and a decode timestamp is not present in the bytestream, then the decode timestamp is equal to the presentation timestamp.</p></dd>
     1.5  
     1.6            <dt id="parent-media-source">Parent Media Source</dt>
     1.7 -          <dd>The parent media source of a <a>SourceBuffer</a> object is the <a>MediaSource</a> object that created it.</dd>
     1.8 +          <dd><p>The parent media source of a <a>SourceBuffer</a> object is the <a>MediaSource</a> object that created it.</p></dd>
     1.9  
    1.10            <dt id="append-sequence">Append Sequence</dt>
    1.11 -          <dd>A series of <a def-id="appendBuffer"></a> or <a def-id="appendStream"></a> calls on a <a>SourceBuffer</a> without any intervening <a def-id="abort"></a> calls. The
    1.12 +          <dd><p>A series of <a def-id="appendBuffer"></a> or <a def-id="appendStream"></a> calls on a <a>SourceBuffer</a> without any intervening <a def-id="abort"></a> calls. The
    1.13              <a def-id="media-segments"></a> in an append sequence must be adjacent and monotonically increasing in decode time without any gaps. An
    1.14              <a def-id="abort"></a> call starts a new append sequence which allows <a def-id="media-segments"></a> to be appended in non-monotonically
    1.15 -            increasing order.
    1.16 +            increasing order.</p>
    1.17            </dd>
    1.18  
    1.19            <dt id="append-window">Append Window</dt>
    1.20 -          <dd>A presentation timestamp range used to filter out <a def-id="coded-frames"></a> while appending. The append window represents a single
    1.21 +          <dd><p>A presentation timestamp range used to filter out <a def-id="coded-frames"></a> while appending. The append window represents a single
    1.22              continuous time range with a single start time and end time. Coded frames with presentation timestamps within this range are allowed to be appended
    1.23              to the <a>SourceBuffer</a> while coded frames outside this range are filtered out. The append window start and end times are controlled by
    1.24 -            the <a def-id="appendWindowStart"></a> and <a def-id="appendWindowEnd"></a> attributes respectively.</dd>
    1.25 +            the <a def-id="appendWindowStart"></a> and <a def-id="appendWindowEnd"></a> attributes respectively.</p></dd>
    1.26 +
    1.27 +          <dt id="active-track-buffers">Active Track Buffers</dt>
    1.28 +          <dd><p>The <a def-id="track-buffers"></a> that provide <a def-id="coded-frames"></a> for the <a def-id="audiotrack-enabled"></a>
    1.29 +              <a def-id="audiotracks"></a>, the <a def-id="videotrack-selected"></a> <a def-id="videotracks"></a>, and the
    1.30 +              <a def-id="texttrack-showing"></a> or <a def-id="texttrack-hidden"></a> <a def-id="texttracks"></a>. All these tracks are associated with
    1.31 +            <a>SourceBuffer</a> objects in the <a def-id="activeSourceBuffers"></a> list.</p>
    1.32 +          </dd>
    1.33          </dl>
    1.34        </section>
    1.35      </section>
    1.36 @@ -475,7 +482,8 @@
    1.37                </dl>
    1.38              </li>
    1.39              <li>The media element resets all decoders and initializes each one with data from the appropriate <a def-id="init-segment"></a>.</li>
    1.40 -            <li>The media element feeds data from the <a def-id="media-segments"></a> into the decoders until the <var>new playback position</var> is reached.</li>
    1.41 +            <li>The media element feeds <a def-id="coded-frames"></a> from the <a def-id="active-track-buffers"></a> into the decoders starting with the
    1.42 +              closest <a def-id="random-access-point"></a> before the the <var>new playback position</var>.</li>
    1.43              <li>Resume the <a def-id="hme-seek-algorithm"></a> at the "<i>Await a stable state</i>" step.</li>
    1.44            </ol>
    1.45          </section>
    1.46 @@ -869,6 +877,10 @@
    1.47            the decode timestamp of the last <a def-id="coded-frame"></a> appended in the current <a def-id="append-sequence"></a>. The variable is initially
    1.48            unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
    1.49  
    1.50 +        <p>Each <a def-id="track-buffer"></a> has a <dfn id="last-frame-duration">last frame duration</dfn> variable that stores
    1.51 +          the frame duration of the last <a def-id="coded-frame"></a> appended in the current <a def-id="append-sequence"></a>. The variable is initially
    1.52 +          unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
    1.53 +
    1.54          <p>Each <a def-id="track-buffer"></a> has a <dfn id="highest-presentation-timestamp">highest presentation timestamp</dfn> variable that stores
    1.55            the highest presentation timestamp encountered in a <a def-id="coded-frame"></a> appended in the current <a def-id="append-sequence"></a>.
    1.56            The variable is initially unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
    1.57 @@ -1028,6 +1040,7 @@
    1.58            <ol>
    1.59              <li>If the <a def-id="append-state"></a> equals <a def-id="parsing-media-segment"></a> and the <a def-id="input-buffer"></a> contains some complete <a def-id="coded-frames"></a>, then run the <a def-id="coded-frame-processing-algorithm"></a> as if the media segment only contained these frames.</li>
    1.60              <li>Unset the <a def-id="last-decode-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
    1.61 +            <li>Unset the <a def-id="last-frame-duration"></a> on all <a def-id="track-buffers"></a>.</li>
    1.62              <li>Unset the <a def-id="highest-presentation-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
    1.63              <li>Unset the <a def-id="highest-presentation-end-timestamp"></a>.</li>
    1.64              <li>Set the <a def-id="need-RAP-flag"></a> on all <a def-id="track-buffers"></a> to true.</li>
    1.65 @@ -1280,7 +1293,7 @@
    1.66                  <li>Let <var>track buffer</var> equal the <a def-id="track-buffer"></a> that the coded frame should be added to.</li>
    1.67                  <li>If <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> is set and <var>decode timestamp</var> is less than
    1.68                    <a def-id="last-decode-timestamp"></a> or the difference between <var>decode timestamp</var> and <a def-id="last-decode-timestamp"></a>
    1.69 -                  is greater than 100 milliseconds, then call <a def-id="eos-decode"></a> and abort these steps.
    1.70 +                  is greater than 2 times <a def-id="last-frame-duration"></a>, then call <a def-id="eos-decode"></a> and abort these steps.
    1.71                    <p class="note">These checks trigger an error when the application attempts out-of-order appends without an intervening
    1.72                      <a def-id="abort"></a>.</p>
    1.73                  </li>
    1.74 @@ -1334,10 +1347,23 @@
    1.75                        <a def-id="highest-presentation-timestamp"></a> and less than or equal to <var>frame end timestamp</var>.</dd>
    1.76                    </dl>
    1.77                  </li>
    1.78 -                <li>Remove all <a def-id="coded-frames"></a> from <var>track buffer</var> that have decoding dependencies on the coded frames removed in
    1.79 -                  the previous step.
    1.80 -                  <p class="note">For example if an I-frame is removed in the previous step, then all P-frames & B-frames that depend on that I-frame
    1.81 -                    should be removed from <var>track buffer</var>. This makes sure that decode dependencies are properly maintained during overlaps.</p>
    1.82 +                <li>Remove decoding dependencies of the coded frames removed in the previous step:
    1.83 +                  <dl class="switch">
    1.84 +                    <dt>If detailed information about decoding dependencies is available:</dt>
    1.85 +                    <dd>Remove all <a def-id="coded-frames"></a> from <var>track buffer</var> that have decoding dependencies on the coded frames removed in
    1.86 +                      the previous step.
    1.87 +                      <p class="note">For example if an I-frame is removed in the previous step, then all P-frames & B-frames that depend on that I-frame
    1.88 +                        should be removed from <var>track buffer</var>. This makes sure that decode dependencies are properly maintained during overlaps.
    1.89 +                      </p>
    1.90 +                    </dd>
    1.91 +                    <dt>Otherwise:</dt>
    1.92 +                    <dd>Remove all <a def-id="coded-frames"></a> between the coded frames removed in the previous step and the next
    1.93 +                      <a def-id="random-access-point"></a> after those removed frames.
    1.94 +                      <p class="note">Removing all <a def-id="coded-frames"></a> until the next <a def-id="random-access-point"></a> is a conservative
    1.95 +                        estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
    1.96 +                        depended on the frames that were removed.
    1.97 +                      </p>
    1.98 +                    </dd>
    1.99                  </li>
   1.100                  <li>
   1.101                    <dl class="switch">
   1.102 @@ -1348,6 +1374,7 @@
   1.103                        <var>track buffer</var>.</dd>
   1.104                    </dl>
   1.105                  <li>Set <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> to <var>decode timestamp</var>.</li>
   1.106 +                <li>Set <a def-id="last-frame-duration"></a> for <var>track buffer</var> to <var>frame duration</var>.</li>
   1.107                  <li>If <a def-id="highest-presentation-timestamp"></a> for <var>track buffer</var> is unset or <var>frame end timestamp</var> is greater
   1.108                    than <a def-id="highest-presentation-timestamp"></a>, then set <a def-id="highest-presentation-timestamp"></a> for <var>track buffer</var>
   1.109                    to <var>frame end timestamp</var>.
   1.110 @@ -1471,6 +1498,10 @@
   1.111                      <li>The decode time set to the <var>overlapped frame</var> decode time.</li>
   1.112                      <li>The frame duration set to difference between <var>presentation timestamp</var> and the <var>overlapped frame</var> presentation time.</li>
   1.113                    </ul>
   1.114 +                  <p class="note">
   1.115 +                    Some implementations may apply fades to/from silence to coded frames on either side of the inserted silence to make the transition less
   1.116 +                    jarring.
   1.117 +                  </p>
   1.118                  </li>
   1.119                  <li>Return to caller without providing a splice frame.
   1.120                    <p class="note">
   1.121 @@ -1516,10 +1547,13 @@
   1.122              <li>Let <var>fade out samples</var> be the samples generated by decoding <var>fade out coded frames</var>.</li>
   1.123              <li>Trim <var>fade out samples</var> so that it only contains samples between <var>presentation timestamp</var> and <var>splice end timestamp</var>.</li>
   1.124              <li>Let <var>fade in samples</var> be the samples generated by decoding <var>fade in coded frames</var>.</li>
   1.125 -            <li>Convert <var>fade out samples</var> and <var>fade in samples</var> to a common sample rate and channel layout.</li>
   1.126 +            <li>If <var>fade out samples</var> and <var>fade in samples</var> do not have a common sample rate and channel layout, then convert
   1.127 +              <var>fade out samples</var> and <var>fade in samples</var> to a common sample rate and channel layout.</li>
   1.128              <li>Let <var>output samples</var> be a buffer to hold the output samples.</li>
   1.129 -            <li>Apply a linear gain fade out to the samples between <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade out samples</var>.</li>
   1.130 -            <li>Apply a linear gain fade in to the samples between <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade in samples</var>.</li>
   1.131 +            <li>Apply a linear gain fade out with a starting gain of 1 and an ending gain of 0 to the samples between
   1.132 +              <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade out samples</var>.</li>
   1.133 +            <li>Apply a linear gain fade in with a starting gain of 0 and an ending gain of 1 to the samples between <var>splice timestamp</var> and
   1.134 +              <var>splice end timestamp</var> in <var>fade in samples</var>.</li>
   1.135              <li>Copy samples between <var>presentation timestamp</var> to <var>splice timestamp</var> from <var>fade out samples</var> into <var>output samples</var>.</li>
   1.136              <li>For each sample between <var>splice timestamp</var> and <var>splice end timestamp</var>, compute the sum of a sample from <var>fade out samples</var> and the
   1.137                corresponding sample in <var>fade in samples</var> and store the result in <var>output samples</var>.</li>
   1.138 @@ -2090,8 +2124,19 @@
   1.139            </tr>
   1.140          </thead>
   1.141          <tbody>
   1.142 +          <td>08 April 2013</a></td>
   1.143 +            <td>
   1.144 +              <ul>
   1.145 +                <li>Bug 21327 - Crossfade clarifications.</li>
   1.146 +                <li>Bug 21334 - Clarified seeking behavoir.</li>
   1.147 +                <li>Bug 21326 - Add a note stating some implementations may choose to add fades to/from silence.</li>
   1.148 +                <li>Bug 21375 - Clarified decode dependency removal.</li>
   1.149 +                <li>Bug 21376 - Replace 100ms limit with 2x last frame duration limit.</li>
   1.150 +              </ul>
   1.151 +            </td>
   1.152 +          </tr>
   1.153            <tr>
   1.154 -            <td>26 March 2013</td>
   1.155 +            <td><a href="https://dvcs.w3.org/hg/html-media/rev/1e6898152c5b">26 March 2013</a></td>
   1.156              <td>
   1.157                <ul>
   1.158                  <li>Bug 21301 - Change timeline references to "media timeline" links.</li>
     2.1 --- a/media-source/media-source.html	Thu Mar 28 09:58:23 2013 -0700
     2.2 +++ b/media-source/media-source.html	Mon Apr 08 12:40:25 2013 -0700
     2.3 @@ -421,7 +421,7 @@
     2.4    </p>
     2.5    <h1 class="title" id="title">Media Source Extensions</h1>
     2.6    
     2.7 -  <h2 id="w3c-editor-s-draft-26-march-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 26 March 2013</h2>
     2.8 +  <h2 id="w3c-editor-s-draft-08-april-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 08 April 2013</h2>
     2.9    <dl>
    2.10      
    2.11        <dt>This version:</dt>
    2.12 @@ -596,20 +596,27 @@
    2.13            <dd><p>A unit of compressed media data that has a presentation timestamp and  decode timestamp. The presentation timestamp indicates when the frame should be rendered. The decode timestamp indicates when the frame needs to be decoded. If frames can be decoded out of order, then the decode timestamp must be present in the bytestream. If frames cannot be decoded out of order and a decode timestamp is not present in the bytestream, then the decode timestamp is equal to the presentation timestamp.</p></dd>
    2.14  
    2.15            <dt id="parent-media-source">Parent Media Source</dt>
    2.16 -          <dd>The parent media source of a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object is the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object that created it.</dd>
    2.17 +          <dd><p>The parent media source of a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object is the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object that created it.</p></dd>
    2.18  
    2.19            <dt id="append-sequence">Append Sequence</dt>
    2.20 -          <dd>A series of <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> or <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> calls on a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> without any intervening <code><a href="#widl-SourceBuffer-abort-void-AbortMode-mode">abort()</a></code> calls. The
    2.21 +          <dd><p>A series of <code><a href="#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data">appendBuffer()</a></code> or <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> calls on a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> without any intervening <code><a href="#widl-SourceBuffer-abort-void-AbortMode-mode">abort()</a></code> calls. The
    2.22              <a href="#media-segment">media segments</a> in an append sequence must be adjacent and monotonically increasing in decode time without any gaps. An
    2.23              <code><a href="#widl-SourceBuffer-abort-void-AbortMode-mode">abort()</a></code> call starts a new append sequence which allows <a href="#media-segment">media segments</a> to be appended in non-monotonically
    2.24 -            increasing order.
    2.25 +            increasing order.</p>
    2.26            </dd>
    2.27  
    2.28            <dt id="append-window">Append Window</dt>
    2.29 -          <dd>A presentation timestamp range used to filter out <a href="#coded-frame">coded frames</a> while appending. The append window represents a single
    2.30 +          <dd><p>A presentation timestamp range used to filter out <a href="#coded-frame">coded frames</a> while appending. The append window represents a single
    2.31              continuous time range with a single start time and end time. Coded frames with presentation timestamps within this range are allowed to be appended
    2.32              to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> while coded frames outside this range are filtered out. The append window start and end times are controlled by
    2.33 -            the <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> and <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code> attributes respectively.</dd>
    2.34 +            the <code><a href="#widl-SourceBuffer-appendWindowStart">appendWindowStart</a></code> and <code><a href="#widl-SourceBuffer-appendWindowEnd">appendWindowEnd</a></code> attributes respectively.</p></dd>
    2.35 +
    2.36 +          <dt id="active-track-buffers">Active Track Buffers</dt>
    2.37 +          <dd><p>The <a href="#track-buffer">track buffers</a> that provide <a href="#coded-frame">coded frames</a> for the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled</a></code>
    2.38 +              <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-audiotracks">audioTracks</a></code>, the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected</a></code> <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-videotracks">videoTracks</a></code>, and the
    2.39 +              <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-showing">"showing"</a></code> or <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-hidden">"hidden"</a></code> <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-texttracks">textTracks</a></code>. All these tracks are associated with
    2.40 +            <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in the <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> list.</p>
    2.41 +          </dd>
    2.42          </dl>
    2.43        </section>
    2.44      </section>
    2.45 @@ -892,7 +899,8 @@
    2.46                </dl>
    2.47              </li>
    2.48              <li>The media element resets all decoders and initializes each one with data from the appropriate <a href="#init-segment">initialization segment</a>.</li>
    2.49 -            <li>The media element feeds data from the <a href="#media-segment">media segments</a> into the decoders until the <var>new playback position</var> is reached.</li>
    2.50 +            <li>The media element feeds <a href="#coded-frame">coded frames</a> from the <a href="#active-track-buffers">active track buffers</a> into the decoders starting with the
    2.51 +              closest <a href="#random-access-point">random access point</a> before the the <var>new playback position</var>.</li>
    2.52              <li>Resume the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seek">seek algorithm</a> at the "<i>Await a stable state</i>" step.</li>
    2.53            </ol>
    2.54          </section>
    2.55 @@ -1259,6 +1267,10 @@
    2.56            the decode timestamp of the last <a href="#coded-frame">coded frame</a> appended in the current <a href="#append-sequence">append sequence</a>. The variable is initially
    2.57            unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
    2.58  
    2.59 +        <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="last-frame-duration">last frame duration</dfn> variable that stores
    2.60 +          the frame duration of the last <a href="#coded-frame">coded frame</a> appended in the current <a href="#append-sequence">append sequence</a>. The variable is initially
    2.61 +          unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
    2.62 +
    2.63          <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="highest-presentation-timestamp">highest presentation timestamp</dfn> variable that stores
    2.64            the highest presentation timestamp encountered in a <a href="#coded-frame">coded frame</a> appended in the current <a href="#append-sequence">append sequence</a>.
    2.65            The variable is initially unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
    2.66 @@ -1418,6 +1430,7 @@
    2.67            <ol>
    2.68              <li>If the <var><a href="#sourcebuffer-append-state">append state</a></var> equals <a href="#sourcebuffer-parsing-media-segment">PARSING_MEDIA_SEGMENT</a> and the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var> contains some complete <a href="#coded-frame">coded frames</a>, then run the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> as if the media segment only contained these frames.</li>
    2.69              <li>Unset the <var><a href="#last-decode-timestamp">last decode timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
    2.70 +            <li>Unset the <var><a href="#last-frame-duration">last frame duration</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
    2.71              <li>Unset the <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
    2.72              <li>Unset the <var><a href="#sourcebuffer-highest-presentation-end-timestamp">highest presentation end timestamp</a></var>.</li>
    2.73              <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on all <a href="#track-buffer">track buffers</a> to true.</li>
    2.74 @@ -1670,7 +1683,7 @@
    2.75                  <li>Let <var>track buffer</var> equal the <a href="#track-buffer">track buffer</a> that the coded frame should be added to.</li>
    2.76                  <li>If <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> is set and <var>decode timestamp</var> is less than
    2.77                    <var><a href="#last-decode-timestamp">last decode timestamp</a></var> or the difference between <var>decode timestamp</var> and <var><a href="#last-decode-timestamp">last decode timestamp</a></var>
    2.78 -                  is greater than 100 milliseconds, then call <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream("decode")</a></code> and abort these steps.
    2.79 +                  is greater than 2 times <var><a href="#last-frame-duration">last frame duration</a></var>, then call <code><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream("decode")</a></code> and abort these steps.
    2.80                    <div class="note"><div class="note-title"><span>Note</span></div><p class="">These checks trigger an error when the application attempts out-of-order appends without an intervening
    2.81                      <code><a href="#widl-SourceBuffer-abort-void-AbortMode-mode">abort()</a></code>.</p></div>
    2.82                  </li>
    2.83 @@ -1724,11 +1737,24 @@
    2.84                        <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> and less than or equal to <var>frame end timestamp</var>.</dd>
    2.85                    </dl>
    2.86                  </li>
    2.87 -                <li>Remove all <a href="#coded-frame">coded frames</a> from <var>track buffer</var> that have decoding dependencies on the coded frames removed in
    2.88 -                  the previous step.
    2.89 -                  <div class="note"><div class="note-title"><span>Note</span></div><p class="">For example if an I-frame is removed in the previous step, then all P-frames &amp; B-frames that depend on that I-frame
    2.90 -                    should be removed from <var>track buffer</var>. This makes sure that decode dependencies are properly maintained during overlaps.</p></div>
    2.91 -                </li>
    2.92 +                <li>Remove decoding dependencies of the coded frames removed in the previous step:
    2.93 +                  <dl class="switch">
    2.94 +                    <dt>If detailed information about decoding dependencies is available:</dt>
    2.95 +                    <dd>Remove all <a href="#coded-frame">coded frames</a> from <var>track buffer</var> that have decoding dependencies on the coded frames removed in
    2.96 +                      the previous step.
    2.97 +                      <div class="note"><div class="note-title"><span>Note</span></div><p class="">For example if an I-frame is removed in the previous step, then all P-frames &amp; B-frames that depend on that I-frame
    2.98 +                        should be removed from <var>track buffer</var>. This makes sure that decode dependencies are properly maintained during overlaps.
    2.99 +                      </p></div>
   2.100 +                    </dd>
   2.101 +                    <dt>Otherwise:</dt>
   2.102 +                    <dd>Remove all <a href="#coded-frame">coded frames</a> between the coded frames removed in the previous step and the next
   2.103 +                      <a href="#random-access-point">random access point</a> after those removed frames.
   2.104 +                      <div class="note"><div class="note-title"><span>Note</span></div><p class="">Removing all <a href="#coded-frame">coded frames</a> until the next <a href="#random-access-point">random access point</a> is a conservative
   2.105 +                        estimate of the decoding dependencies since it assumes all frames between the removed frames and the next random access point
   2.106 +                        depended on the frames that were removed.
   2.107 +                      </p></div>
   2.108 +                    </dd>
   2.109 +                </dl></li>
   2.110                  <li>
   2.111                    <dl class="switch">
   2.112                      <dt>If <var>spliced frame</var> is set:</dt>
   2.113 @@ -1738,6 +1764,7 @@
   2.114                        <var>track buffer</var>.</dd>
   2.115                    </dl>
   2.116                  </li><li>Set <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> to <var>decode timestamp</var>.</li>
   2.117 +                <li>Set <var><a href="#last-frame-duration">last frame duration</a></var> for <var>track buffer</var> to <var>frame duration</var>.</li>
   2.118                  <li>If <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> for <var>track buffer</var> is unset or <var>frame end timestamp</var> is greater
   2.119                    than <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var>, then set <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> for <var>track buffer</var>
   2.120                    to <var>frame end timestamp</var>.
   2.121 @@ -1861,6 +1888,10 @@
   2.122                      <li>The decode time set to the <var>overlapped frame</var> decode time.</li>
   2.123                      <li>The frame duration set to difference between <var>presentation timestamp</var> and the <var>overlapped frame</var> presentation time.</li>
   2.124                    </ul>
   2.125 +                  <div class="note"><div class="note-title"><span>Note</span></div><p class="">
   2.126 +                    Some implementations may apply fades to/from silence to coded frames on either side of the inserted silence to make the transition less
   2.127 +                    jarring.
   2.128 +                  </p></div>
   2.129                  </li>
   2.130                  <li>Return to caller without providing a splice frame.
   2.131                    <div class="note"><div class="note-title"><span>Note</span></div><p class="">
   2.132 @@ -1906,10 +1937,13 @@
   2.133              <li>Let <var>fade out samples</var> be the samples generated by decoding <var>fade out coded frames</var>.</li>
   2.134              <li>Trim <var>fade out samples</var> so that it only contains samples between <var>presentation timestamp</var> and <var>splice end timestamp</var>.</li>
   2.135              <li>Let <var>fade in samples</var> be the samples generated by decoding <var>fade in coded frames</var>.</li>
   2.136 -            <li>Convert <var>fade out samples</var> and <var>fade in samples</var> to a common sample rate and channel layout.</li>
   2.137 +            <li>If <var>fade out samples</var> and <var>fade in samples</var> do not have a common sample rate and channel layout, then convert
   2.138 +              <var>fade out samples</var> and <var>fade in samples</var> to a common sample rate and channel layout.</li>
   2.139              <li>Let <var>output samples</var> be a buffer to hold the output samples.</li>
   2.140 -            <li>Apply a linear gain fade out to the samples between <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade out samples</var>.</li>
   2.141 -            <li>Apply a linear gain fade in to the samples between <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade in samples</var>.</li>
   2.142 +            <li>Apply a linear gain fade out with a starting gain of 1 and an ending gain of 0 to the samples between
   2.143 +              <var>splice timestamp</var> and <var>splice end timestamp</var> in <var>fade out samples</var>.</li>
   2.144 +            <li>Apply a linear gain fade in with a starting gain of 0 and an ending gain of 1 to the samples between <var>splice timestamp</var> and
   2.145 +              <var>splice end timestamp</var> in <var>fade in samples</var>.</li>
   2.146              <li>Copy samples between <var>presentation timestamp</var> to <var>splice timestamp</var> from <var>fade out samples</var> into <var>output samples</var>.</li>
   2.147              <li>For each sample between <var>splice timestamp</var> and <var>splice end timestamp</var>, compute the sum of a sample from <var>fade out samples</var> and the
   2.148                corresponding sample in <var>fade in samples</var> and store the result in <var>output samples</var>.</li>
   2.149 @@ -2460,8 +2494,19 @@
   2.150            </tr>
   2.151          </thead>
   2.152          <tbody>
   2.153 +          <tr><td>08 April 2013</td>
   2.154 +            <td>
   2.155 +              <ul>
   2.156 +                <li>Bug 21327 - Crossfade clarifications.</li>
   2.157 +                <li>Bug 21334 - Clarified seeking behavoir.</li>
   2.158 +                <li>Bug 21326 - Add a note stating some implementations may choose to add fades to/from silence.</li>
   2.159 +                <li>Bug 21375 - Clarified decode dependency removal.</li>
   2.160 +                <li>Bug 21376 - Replace 100ms limit with 2x last frame duration limit.</li>
   2.161 +              </ul>
   2.162 +            </td>
   2.163 +          </tr>
   2.164            <tr>
   2.165 -            <td>26 March 2013</td>
   2.166 +            <td><a href="https://dvcs.w3.org/hg/html-media/rev/1e6898152c5b">26 March 2013</a></td>
   2.167              <td>
   2.168                <ul>
   2.169                  <li>Bug 21301 - Change timeline references to "media timeline" links.</li>
     3.1 --- a/media-source/media-source.js	Thu Mar 28 09:58:23 2013 -0700
     3.2 +++ b/media-source/media-source.js	Mon Apr 08 12:40:25 2013 -0700
     3.3 @@ -124,6 +124,7 @@
     3.4      'append-sequence': { func: term_helper, fragment: 'append-sequence', link_text: 'append sequence', },
     3.5      'append-window': { func: term_helper, fragment: 'append-window', link_text: 'append window', },
     3.6      'enough-data': { func: term_helper, fragment: 'enough-data', link_text: 'enough data to ensure uninterrupted playback', },
     3.7 +    'active-track-buffers': { func: term_helper, fragment: 'active-track-buffers', link_text: 'active track buffers', },
     3.8  
     3.9      'duration-change-algorithm': { func: link_helper, fragment: '#duration-change-algorithm', link_text: 'duration change algorithm', },
    3.10      'segment-parser-loop': { func: link_helper, fragment: '#sourcebuffer-segment-parser-loop', link_text: 'segment parser loop', },
    3.11 @@ -153,6 +154,7 @@
    3.12      'track-buffer': { func: term_helper, fragment: 'track-buffer', link_text: 'track buffer', },
    3.13      'track-buffers': { func: term_helper, fragment: 'track-buffer', link_text: 'track buffers', },
    3.14      'last-decode-timestamp': { func: var_helper, fragment: '#last-decode-timestamp', link_text: 'last decode timestamp', },
    3.15 +    'last-frame-duration': { func: var_helper, fragment: '#last-frame-duration', link_text: 'last frame duration', },
    3.16      'highest-presentation-timestamp': { func: var_helper, fragment: '#highest-presentation-timestamp', link_text: 'highest presentation timestamp', },
    3.17      'need-RAP-flag': { func: var_helper, fragment: '#need-RAP-flag', link_text: 'need random access point flag', },
    3.18