Bug 20899 - Remove media segments must start with a random access point requirement.
authorAaron Colwell <acolwell@chromium.org>
Mon, 25 Feb 2013 10:35:43 -0800
changeset 87 668a1c82fb88
parent 86 d5956e93b991
child 88 1920147a47af
Bug 20899 - Remove media segments must start with a random access point requirement.
Bug 21065 - Update example code to use updating attribute instead of old appending attribute.
Remove Source Buffer Model section since all the behavior is covered by the algorithms now.
media-source/complete_overlap.png
media-source/end_overlap.png
media-source/media-source-respec.html
media-source/media-source.html
media-source/media-source.js
media-source/middle_overlap.png
media-source/start_overlap.png
Binary file media-source/complete_overlap.png has changed
Binary file media-source/end_overlap.png has changed
--- a/media-source/media-source-respec.html	Mon Feb 18 13:44:34 2013 -0800
+++ b/media-source/media-source-respec.html	Mon Feb 25 10:35:43 2013 -0800
@@ -127,9 +127,6 @@
             <p class="note">The <a def-id="byte-stream-format-specs"></a> contain format specific examples.</p>
           </dd>
 
-          <dt id="decoder-buffer">Decoder Buffer</dt>
-          <dd><p>A buffer that holds initialization data and <a def-id="coded-frames"></a> that will be decoded and rendered. This buffer may not exist in actual implementations, but it is intended to represent media data that will be decoded no matter what <a def-id="media-segments"></a> are appended to update the <a>SourceBuffer</a>. This distinction is important when considering appends that happen close to the current playback position. See <a href="#track-buffer-to-decoder-buffer">Track Buffer to Decoder Buffer transfer</a> for details.</p></dd>
-
           <dt id="random-access-point">Random Access Point</dt>
           <dd><p>A position in a <a def-id="media-segment"></a> where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams.</p></dd>
 
@@ -163,65 +160,6 @@
       </section>
     </section>
 
-
-    <section id="source-buffer-model">
-      <h2>Source Buffer Model</h2>
-      <div class="nonnormative">
-        <p>The subsections below outline the buffering model for this specification. It describes the various rules and behaviors associated with appending
- data to an individual <a>SourceBuffer</a>. At the highest level, the web application creates <a>SourceBuffer</a> objects and appends sequences of 
-<a def-id="init-segments"></a> and <a def-id="media-segments"></a> to update their state. The media element pulls media data out of the 
-<a>MediaSource</a> object, plays it, and fires events just like it would if a normal URL was passed to the <a def-id="media-src"></a> attribute.
- The web application is expected to monitor media element events to determine when it needs to append more <a def-id="media-segments"></a>.</p>
-      </div>
-
-      <section id="source-buffer-overlapping-segments">
-        <h3>Appending a Media Segment over a buffered region</h3>
-        <p>There are several ways that <a def-id="media-segments"></a> can overlap segments in the <a>SourceBuffer</a>. Behavior for the different overlap situations are described below. If more than one overlap applies, then the <a href="#source-buffer-overlap-start">start overlap</a> must be resolved first, followed by any <a href="#source-buffer-overlap-complete">complete overlaps</a>, and finally the <a href="#source-buffer-overlap-end">end overlap</a>. If a segment contains multiple tracks then the overlap is resolved independently for each track.</p>
-
-        <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=19673">Bug 19673</a> - Seamless audio signal transitions at splice points</p>
-        <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=19784">Bug 19784</a> - timestampOffset with multiplexed Media Segments</p>
-
-        <section id="source-buffer-overlap-complete">
-          <h4>Complete Overlap</h4>
-          <img src="complete_overlap.png" alt="Complete overlap diagram">
-          <p>The figure above shows how the <a>SourceBuffer</a> is updated when a new <a def-id="media-segment"></a> completely overlaps a segment in the buffer. In this case, the new segment completely replaces the old segment.</p>
-        </section>
-
-        <section id="source-buffer-overlap-start">
-          <h4>Start Overlap</h4>
-          <img src="start_overlap.png" alt="Start overlap diagram">
-          <p>The figure above shows how the <a>SourceBuffer</a> is updated when the beginning of a new <a def-id="media-segment"></a> overlaps a segment in the buffer. In this case, the new segment replaces all the old media data in the overlapping region. Since <a def-id="media-segments"></a> are constrained to starting with <a def-id="random-access-points"></a>, this provides a seamless transition between segments.</p>
-          <p>When an audio frame in the <a>SourceBuffer</a> overlaps with the start of the new <a def-id="media-segment"></a> special behavior is required. At a minimum implementations must support dropping the old audio frame that overlaps the start of the new segment and insert silence for the small gap that is created. Higher quality implementations may support crossfading or crosslapping between the overlapping audio frames. No matter which strategy is implemented, no gaps are created in the ranges reported by <a def-id="buffered"></a> and playback must never stall at the overlap.</p>
-        </section>
-
-        <section id="source-buffer-overlap-end">
-          <h4>End Overlap</h4>
-          <img src="end_overlap.png" alt="End overlap diagram">
-          <p>The figure above shows how the <a>SourceBuffer</a> is updated when the end of a new <a def-id="media-segment"></a> overlaps the beginning of a segment in the buffer. In this case, the <a>SourceBuffer</a> tries to keep as much of the old segment as possible. The amount saved depends on where the closest <a def-id="random-access-point"></a>, in the old segment, is to the end of the new segment. In the case of audio, if the gap is smaller than the size of an audio frame, then the <a>SourceBuffer</a> may render silence for this gap. This gap must not be reflect in <a def-id="buffered"></a>. The entire new segment must be added to the <a>SourceBuffer</a>, but it is up to the implementation to determine how much of the old segment data is retained.</p>
-
-
-          <p class="note">An implementation may keep old segment data before the end of the new segment to avoid creating a gap if it wishes. Doing this though can significantly increase implementation complexity and could cause delays at the splice point.</p>
-
-          <p class="note"> The web application can use <a def-id="buffered"></a> to determine how much of the old segment was preserved.</p>
-        </section>
-
-        <section id="source-buffer-overlap-middle">
-          <h4>Middle Overlap</h4>
-          <img src="middle_overlap.png" alt="Middle overlap diagram">
-          <p>The figure above shows how the <a>SourceBuffer</a> is updated when the new <a def-id="media-segment"></a> is in the middle of the old segment. This condition is handled by first resolving the <a href="#source-buffer-overlap-start">start overlap</a> and then resolving the <a href="#source-buffer-overlap-end">end overlap</a>.</p>
-        </section>
-      </section>
-
-      <section id="track-buffer-to-decoder-buffer">
-        <h3>Track Buffer to Decoder Buffer transfer</h3>
-        <div class="nonnormative">
-        <p>The <a def-id="track-buffer"></a> represents the media that the web application would like the media element to play. The <a def-id="decoder-buffer"></a> contains the data that will actually get decoded and rendered. In most cases the <a def-id="decoder-buffer"></a> will simply contain a subset of the <a def-id="track-buffer"></a> near the current playback position. These two buffers start to diverge when <a def-id="media-segments"></a> that overlap or are very close to the current playback position are appended. Depending on the contents of the new <a def-id="media-segment"></a> it may not be possible to switch to the new data immediately because there isn't a <a def-id="random-access-point"></a> close enough to the current playback position. The quality of the implementation determines how much data is considered &quot;in the <a def-id="decoder-buffer"></a>.&quot; It should transfer data to the <a def-id="decoder-buffer"></a> as late as possible whilst maintaining seamless playback. Some implementations may be able to instantiate multiple decoders or decode the new data significantly faster than real-time to achieve a seamless splice immediately. Other implementations may delay until the next <a def-id="random-access-point"></a> before switching to the newly appended data. Notice that this difference in behavior is only observable when appending close to the current playback position. The <a def-id="decoder-buffer"></a> represents a media subsegment, like a group of pictures or something with similar decode dependencies, that the media element commits to playing. This commitment may be influenced by a variety of things like limited decoding resources, hardware decode buffers, a jitter buffer, or the desire to limit implementation complexity.</p>
-
-        <p>Here is an example to help clarify the role of the <a def-id="decoder-buffer"></a>. Say the current playback position has a timestamp of 8 and the media element pulled frames with timestamp 9 &amp; 10 into the decoder buffer. The web application then appends a higher quality <a def-id="media-segment"></a> that starts with a <a def-id="random-access-point"></a> at timestamp 9. The <a def-id="track-buffer"></a> will get updated with the higher quality data, but the media element won't be able to switch to this higher quality data until the next <a def-id="random-access-point"></a> at timestamp 20. This is because a frame for timestamp 9 is already in the decoder buffer. The decoder buffer represents the "point of no return." for decoding. If a seek occurs the media element may choose to use the higher quality data since a seek might imply flushing the <a def-id="decoder-buffer"></a> and the user expects a break in playback.</p>
-        </div>
-      </section>
-    </section>
-
     <section id="mediasource">
       <h2>MediaSource Object</h2>
       <p>The MediaSource object represents a source of media data for an HTMLMediaElement. It keeps track of the <a def-id="readyState"></a> for this source as well as a list of <a>SourceBuffer</a> objects that can be used to add media data to the presentation. MediaSource objects are created by the web application and then attached to an HTMLMediaElement. The application uses the <a>SourceBuffer</a> objects in <a def-id="sourceBuffers"></a> to add media data to this source. The HTMLMediaElement fetches this media data from the <a>MediaSource</a> object when it is needed during playback.</p>
@@ -668,8 +606,6 @@
     <section id="sourcebuffer">
       <h2>SourceBuffer Object</h2>
 
-      <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20327">Bug 20327</a> - Continuous splice flag</p>
-
       <dl title="interface SourceBuffer : EventTarget" class="idl">
         <dt>readonly attribute boolean updating</dt>
         <dd>
@@ -856,6 +792,11 @@
         <p>Each <a def-id="track-buffer"></a> has a <dfn id="highest-presentation-timestamp">highest presentation timestamp</dfn> variable that stores
           the highest presentation timestamp encountered in a <a def-id="coded-frame"></a> appended in the current <a def-id="append-sequence"></a>.
           The variable is initially unset to indicate that no <a def-id="coded-frames"></a> have been appended yet.</p>
+
+         <p>Each <a def-id="track-buffer"></a> has a <dfn id="need-RAP-flag">need random access point flag</dfn> variable that keeps track of whether
+           the track buffer is waiting for a <a def-id="random-access-point"></a> <a def-id="coded-frame"></a>. The variable is initially set to true to
+           indicate that <a def-id="random-access-point"></a> <a def-id="coded-frame"></a> is needed before anything can be added to the
+           <a def-id="track-buffer"></a>.</p>
       </section>
 
       <section id="sourcebuffer-events">
@@ -986,6 +927,7 @@
             <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>
             <li>Unset the <a def-id="last-decode-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
             <li>Unset the <a def-id="highest-presentation-timestamp"></a> on all <a def-id="track-buffers"></a>.</li>
+            <li>Set the <a def-id="need-RAP-flag"></a> on all <a def-id="track-buffers"></a> to true.</li>
             <li>Remove all bytes from the <a def-id="input-buffer"></a>.</li>
             <li>Set <a def-id="append-state"></a> to <a def-id="waiting-for-segment"></a>.</li>
           </ol>
@@ -1207,6 +1149,13 @@
                 </li>
 
                 <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
+                <li>If the <a def-id="need-RAP-flag"></a> on <var>track buffer</var> equals true, then run the following steps:
+                  <ol>
+                    <li>If the coded frame is not a <a def-id="random-access-point"></a>, then drop the coded frame and jump to the top of the loop to start
+                      processing the next coded frame.</li>
+                    <li>Set the <a def-id="need-RAP-flag"></a> on <var>track buffer</var> to false.</li>
+                  </ol>
+                </li>
                 <li>Let <var>spliced frame</var> be an unset variable for holding audio splice information</li>
                 <li>If <a def-id="last-decode-timestamp"></a> for <var>track buffer</var> is unset and <var>presentation timestamp</var> lies within a
                   <a def-id="coded-frame"></a> already stored in <var>track buffer</var>, then run the following steps:
@@ -1660,7 +1609,6 @@
         <li>The following rules apply to all <a def-id="media-segments"></a> within a byte stream:
           <ol>
             <li>All timestamps must be mapped to the same presentation timeline.</li>
-	    <li>Segments must start with a <a def-id="random-access-point"></a> to facilitate seamless splicing at the segment boundary.</li>
 	    <li>Gaps between <a def-id="media-segments"></a> that are smaller than the audio frame size are allowed and must not cause playback to stall. Such gaps must not be reflected by <a def-id="buffered"></a>.
 	      <p class="note">This is intended to simplify switching between audio streams where the frame boundaries don't always line up across encodings (e.g. Vorbis).</p>
             </li>
@@ -1757,7 +1705,6 @@
 	    <li>External data references must not be used.</li>
 	    <li>If the Movie Fragment contains multiple tracks, the duration by which each track extends should be as close to equal as practical.</li>
 	    <li>Each Track Fragment Box must contain a Track Fragment Decode Time Box (<span class="iso-box">tfdt</span>)</li>
-	    <li>The first sample in each Track Fragment Run Box (<span class="iso-box">trun</span>) must indicate that the sample is a <a def-id="random-access-point"></a>.</li>
 	    <li>The Media Data Boxes must contain all the samples referenced by the Track Fragment Run Boxes (<span class="iso-box">trun</span>) of the Movie Fragment Box.</li>
           </ol>
 	</section>
@@ -1879,7 +1826,7 @@
     }
 
     // Make sure the previous append is not still pending.
-    if (mediaSource.sourceBuffers[0].appending)
+    if (mediaSource.sourceBuffers[0].updating)
         return;
 
     var mediaSegment = GetNextMediaSegment();
@@ -1936,7 +1883,17 @@
         </thead>
         <tbody>
           <tr>
-            <td>19 February 2013</td>
+            <td>25 February 2013</td>
+            <td>
+              <ul>
+                 <li>Remove Source Buffer Model section since all the behavior is covered by the algorithms now.</li>
+                 <li>Bug 20899 - Remove media segments must start with a random access point requirement.</li>
+                 <li>Bug 21065 - Update example code to use updating attribute instead of old appending attribute.</li>
+              </ul>
+            </td>
+          </tr>
+          <tr>
+            <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/d5956e93b991/media-source/media-source.html">19 February 2013</a></td>
             <td>
               <ul>
                  <li>Bug 19676, 20327 - Provide more detail for audio & video splicing.</li>
@@ -1949,7 +1906,7 @@
             </td>
           </tr>
           <tr>
-	    <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/77975abeec41/media-source/media-source.html">05 February 2013</a></td>
+	    <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/77975abeec41/media-source/media-source.html">05 February 2013</a></td>
             <td>
               <ul>
                 <li>Bug 19676 - Added a note clarifying that the internal timestamp representation doesn't have to be a double.</li>
--- a/media-source/media-source.html	Mon Feb 18 13:44:34 2013 -0800
+++ b/media-source/media-source.html	Mon Feb 25 10:35:43 2013 -0800
@@ -397,7 +397,7 @@
   </p>
   <h1 class="title" id="title">Media Source Extensions</h1>
   
-  <h2 id="w3c-editor-s-draft-19-february-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 19 February 2013</h2>
+  <h2 id="w3c-editor-s-draft-25-february-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 25 February 2013</h2>
   <dl>
     
       <dt>This version:</dt>
@@ -507,7 +507,7 @@
       
     
   
-</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1.1 </span>Goals</a></li><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1.2 </span>Definitions</a></li></ul></li><li class="tocline"><a href="#source-buffer-model" class="tocxref"><span class="secno">2. </span>Source Buffer Model</a><ul class="toc"><li class="tocline"><a href="#source-buffer-overlapping-segments" class="tocxref"><span class="secno">2.1 </span>Appending a Media Segment over a buffered region</a><ul class="toc"><li class="tocline"><a href="#source-buffer-overlap-complete" class="tocxref"><span class="secno">2.1.1 </span>Complete Overlap</a></li><li class="tocline"><a href="#source-buffer-overlap-start" class="tocxref"><span class="secno">2.1.2 </span>Start Overlap</a></li><li class="tocline"><a href="#source-buffer-overlap-end" class="tocxref"><span class="secno">2.1.3 </span>End Overlap</a></li><li class="tocline"><a href="#source-buffer-overlap-middle" class="tocxref"><span class="secno">2.1.4 </span>Middle Overlap</a></li></ul></li><li class="tocline"><a href="#track-buffer-to-decoder-buffer" class="tocxref"><span class="secno">2.2 </span>Track Buffer to Decoder Buffer transfer</a></li></ul></li><li class="tocline"><a href="#mediasource" class="tocxref"><span class="secno">3. </span>MediaSource Object</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">3.1 </span>Attributes</a></li><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">3.2 </span>Methods</a></li><li class="tocline"><a href="#mediasource-events" class="tocxref"><span class="secno">3.3 </span>Event Summary</a></li><li class="tocline"><a href="#mediasource-algorithms" class="tocxref"><span class="secno">3.4 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#mediasource-attach" class="tocxref"><span class="secno">3.4.1 </span>Attaching to a media element</a></li><li class="tocline"><a href="#mediasource-detach" class="tocxref"><span class="secno">3.4.2 </span>Detaching from a media element</a></li><li class="tocline"><a href="#mediasource-seeking" class="tocxref"><span class="secno">3.4.3 </span>Seeking</a></li><li class="tocline"><a href="#buffer-monitoring" class="tocxref"><span class="secno">3.4.4 </span>SourceBuffer Monitoring</a></li><li class="tocline"><a href="#active-source-buffer-changes" class="tocxref"><span class="secno">3.4.5 </span>Changes to selected/enabled track state</a></li><li class="tocline"><a href="#duration-change-algorithm" class="tocxref"><span class="secno">3.4.6 </span>Duration change</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebuffer" class="tocxref"><span class="secno">4. </span>SourceBuffer Object</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">4.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">4.2 </span>Methods</a></li><li class="tocline"><a href="#track-buffers" class="tocxref"><span class="secno">4.3 </span>Track Buffers</a></li><li class="tocline"><a href="#sourcebuffer-events" class="tocxref"><span class="secno">4.4 </span>Event Summary</a></li><li class="tocline"><a href="#sourcebuffer-algorithms" class="tocxref"><span class="secno">4.5 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sourcebuffer-segment-parser-loop" class="tocxref"><span class="secno">4.5.1 </span>Segment Parser Loop</a></li><li class="tocline"><a href="#sourcebuffer-reset-parser-state" class="tocxref"><span class="secno">4.5.2 </span>Reset Parser State</a></li><li class="tocline"><a href="#sourcebuffer-append-error" class="tocxref"><span class="secno">4.5.3 </span>Append Error</a></li><li class="tocline"><a href="#sourcebuffer-stream-append-loop" class="tocxref"><span class="secno">4.5.4 </span>Stream Append Loop</a></li><li class="tocline"><a href="#sourcebuffer-init-segment-received" class="tocxref"><span class="secno">4.5.5 </span>Initialization Segment Received</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-processing" class="tocxref"><span class="secno">4.5.6 </span>Coded Frame Processing</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-frame-algorithm" class="tocxref"><span class="secno">4.5.7 </span>Audio Splice Frame Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-rendering-algorithm" class="tocxref"><span class="secno">4.5.8 </span>Audio Splice Rendering Algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebufferlist" class="tocxref"><span class="secno">5. </span>SourceBufferList Object</a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno">5.2 </span>Methods</a></li><li class="tocline"><a href="#sourcebufferlist-events" class="tocxref"><span class="secno">5.3 </span>Event Summary</a></li></ul></li><li class="tocline"><a href="#url" class="tocxref"><span class="secno">6. </span>URL Object</a><ul class="toc"><li class="tocline"><a href="#methods-3" class="tocxref"><span class="secno">6.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#htmlmediaelement-attributes" class="tocxref"><span class="secno">7. </span>HTMLMediaElement attributes</a></li><li class="tocline"><a href="#audio-track-extensions" class="tocxref"><span class="secno">8. </span>AudioTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno">8.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#video-track-extensions" class="tocxref"><span class="secno">9. </span>VideoTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno">9.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#text-track-extensions" class="tocxref"><span class="secno">10. </span>TextTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-5" class="tocxref"><span class="secno">10.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#byte-stream-formats" class="tocxref"><span class="secno">11. </span>Byte Stream Formats</a><ul class="toc"><li class="tocline"><a href="#webm" class="tocxref"><span class="secno">11.1 </span>WebM Byte Streams</a><ul class="toc"><li class="tocline"><a href="#webm-init-segments" class="tocxref"><span class="secno">11.1.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#webm-media-segments" class="tocxref"><span class="secno">11.1.2 </span>Media Segments</a></li><li class="tocline"><a href="#webm-random-access-points" class="tocxref"><span class="secno">11.1.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#iso" class="tocxref"><span class="secno">11.2 </span>ISO Base Media File Format Byte Streams</a><ul class="toc"><li class="tocline"><a href="#iso-init-segments" class="tocxref"><span class="secno">11.2.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#iso-media-segments" class="tocxref"><span class="secno">11.2.2 </span>Media Segments</a></li><li class="tocline"><a href="#iso-random-access-points" class="tocxref"><span class="secno">11.2.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#mpeg2ts" class="tocxref"><span class="secno">11.3 </span>MPEG-2 Transport Stream Byte Streams</a><ul class="toc"><li class="tocline"><a href="#mpeg2ts-general" class="tocxref"><span class="secno">11.3.1 </span>General</a></li><li class="tocline"><a href="#mpeg2ts-init-segments" class="tocxref"><span class="secno">11.3.2 </span>Initialization Segments</a></li><li class="tocline"><a href="#mpeg2ts-media-segments" class="tocxref"><span class="secno">11.3.3 </span>Media Segments</a></li><li class="tocline"><a href="#mpeg2ts-random-access-points" class="tocxref"><span class="secno">11.3.4 </span>Random Access Points</a></li><li class="tocline"><a href="#mpeg2ts-discontinuities" class="tocxref"><span class="secno">11.3.5 </span>Timestamp Rollover &amp; Discontinuities</a></li></ul></li></ul></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">12. </span>Examples</a></li><li class="tocline"><a href="#revision-history" class="tocxref"><span class="secno">13. </span>Revision History</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.1 </span>Informative references</a></li></ul></li></ul></section>
+</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1.1 </span>Goals</a></li><li class="tocline"><a href="#definitions" class="tocxref"><span class="secno">1.2 </span>Definitions</a></li></ul></li><li class="tocline"><a href="#mediasource" class="tocxref"><span class="secno">2. </span>MediaSource Object</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">2.1 </span>Attributes</a></li><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">2.2 </span>Methods</a></li><li class="tocline"><a href="#mediasource-events" class="tocxref"><span class="secno">2.3 </span>Event Summary</a></li><li class="tocline"><a href="#mediasource-algorithms" class="tocxref"><span class="secno">2.4 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#mediasource-attach" class="tocxref"><span class="secno">2.4.1 </span>Attaching to a media element</a></li><li class="tocline"><a href="#mediasource-detach" class="tocxref"><span class="secno">2.4.2 </span>Detaching from a media element</a></li><li class="tocline"><a href="#mediasource-seeking" class="tocxref"><span class="secno">2.4.3 </span>Seeking</a></li><li class="tocline"><a href="#buffer-monitoring" class="tocxref"><span class="secno">2.4.4 </span>SourceBuffer Monitoring</a></li><li class="tocline"><a href="#active-source-buffer-changes" class="tocxref"><span class="secno">2.4.5 </span>Changes to selected/enabled track state</a></li><li class="tocline"><a href="#duration-change-algorithm" class="tocxref"><span class="secno">2.4.6 </span>Duration change</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebuffer" class="tocxref"><span class="secno">3. </span>SourceBuffer Object</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">3.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">3.2 </span>Methods</a></li><li class="tocline"><a href="#track-buffers" class="tocxref"><span class="secno">3.3 </span>Track Buffers</a></li><li class="tocline"><a href="#sourcebuffer-events" class="tocxref"><span class="secno">3.4 </span>Event Summary</a></li><li class="tocline"><a href="#sourcebuffer-algorithms" class="tocxref"><span class="secno">3.5 </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sourcebuffer-segment-parser-loop" class="tocxref"><span class="secno">3.5.1 </span>Segment Parser Loop</a></li><li class="tocline"><a href="#sourcebuffer-reset-parser-state" class="tocxref"><span class="secno">3.5.2 </span>Reset Parser State</a></li><li class="tocline"><a href="#sourcebuffer-append-error" class="tocxref"><span class="secno">3.5.3 </span>Append Error</a></li><li class="tocline"><a href="#sourcebuffer-stream-append-loop" class="tocxref"><span class="secno">3.5.4 </span>Stream Append Loop</a></li><li class="tocline"><a href="#sourcebuffer-init-segment-received" class="tocxref"><span class="secno">3.5.5 </span>Initialization Segment Received</a></li><li class="tocline"><a href="#sourcebuffer-coded-frame-processing" class="tocxref"><span class="secno">3.5.6 </span>Coded Frame Processing</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-frame-algorithm" class="tocxref"><span class="secno">3.5.7 </span>Audio Splice Frame Algorithm</a></li><li class="tocline"><a href="#sourcebuffer-audio-splice-rendering-algorithm" class="tocxref"><span class="secno">3.5.8 </span>Audio Splice Rendering Algorithm</a></li></ul></li></ul></li><li class="tocline"><a href="#sourcebufferlist" class="tocxref"><span class="secno">4. </span>SourceBufferList Object</a><ul class="toc"><li class="tocline"><a href="#attributes-2" class="tocxref"><span class="secno">4.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-2" class="tocxref"><span class="secno">4.2 </span>Methods</a></li><li class="tocline"><a href="#sourcebufferlist-events" class="tocxref"><span class="secno">4.3 </span>Event Summary</a></li></ul></li><li class="tocline"><a href="#url" class="tocxref"><span class="secno">5. </span>URL Object</a><ul class="toc"><li class="tocline"><a href="#methods-3" class="tocxref"><span class="secno">5.1 </span>Methods</a></li></ul></li><li class="tocline"><a href="#htmlmediaelement-attributes" class="tocxref"><span class="secno">6. </span>HTMLMediaElement attributes</a></li><li class="tocline"><a href="#audio-track-extensions" class="tocxref"><span class="secno">7. </span>AudioTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-3" class="tocxref"><span class="secno">7.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#video-track-extensions" class="tocxref"><span class="secno">8. </span>VideoTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-4" class="tocxref"><span class="secno">8.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#text-track-extensions" class="tocxref"><span class="secno">9. </span>TextTrack Extensions</a><ul class="toc"><li class="tocline"><a href="#attributes-5" class="tocxref"><span class="secno">9.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#byte-stream-formats" class="tocxref"><span class="secno">10. </span>Byte Stream Formats</a><ul class="toc"><li class="tocline"><a href="#webm" class="tocxref"><span class="secno">10.1 </span>WebM Byte Streams</a><ul class="toc"><li class="tocline"><a href="#webm-init-segments" class="tocxref"><span class="secno">10.1.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#webm-media-segments" class="tocxref"><span class="secno">10.1.2 </span>Media Segments</a></li><li class="tocline"><a href="#webm-random-access-points" class="tocxref"><span class="secno">10.1.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#iso" class="tocxref"><span class="secno">10.2 </span>ISO Base Media File Format Byte Streams</a><ul class="toc"><li class="tocline"><a href="#iso-init-segments" class="tocxref"><span class="secno">10.2.1 </span>Initialization Segments</a></li><li class="tocline"><a href="#iso-media-segments" class="tocxref"><span class="secno">10.2.2 </span>Media Segments</a></li><li class="tocline"><a href="#iso-random-access-points" class="tocxref"><span class="secno">10.2.3 </span>Random Access Points</a></li></ul></li><li class="tocline"><a href="#mpeg2ts" class="tocxref"><span class="secno">10.3 </span>MPEG-2 Transport Stream Byte Streams</a><ul class="toc"><li class="tocline"><a href="#mpeg2ts-general" class="tocxref"><span class="secno">10.3.1 </span>General</a></li><li class="tocline"><a href="#mpeg2ts-init-segments" class="tocxref"><span class="secno">10.3.2 </span>Initialization Segments</a></li><li class="tocline"><a href="#mpeg2ts-media-segments" class="tocxref"><span class="secno">10.3.3 </span>Media Segments</a></li><li class="tocline"><a href="#mpeg2ts-random-access-points" class="tocxref"><span class="secno">10.3.4 </span>Random Access Points</a></li><li class="tocline"><a href="#mpeg2ts-discontinuities" class="tocxref"><span class="secno">10.3.5 </span>Timestamp Rollover &amp; Discontinuities</a></li></ul></li></ul></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">11. </span>Examples</a></li><li class="tocline"><a href="#revision-history" class="tocxref"><span class="secno">12. </span>Revision History</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.1 </span>Informative references</a></li></ul></li></ul></section>
 
 
     <section id="introduction">
@@ -547,9 +547,6 @@
             <div class="note"><div class="note-title"><span>Note</span></div><p class="">The <a href="#byte-stream-formats">byte stream format specifications</a> contain format specific examples.</p></div>
           </dd>
 
-          <dt id="decoder-buffer">Decoder Buffer</dt>
-          <dd><p>A buffer that holds initialization data and <a href="#coded-frame">coded frames</a> that will be decoded and rendered. This buffer may not exist in actual implementations, but it is intended to represent media data that will be decoded no matter what <a href="#media-segment">media segments</a> are appended to update the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. This distinction is important when considering appends that happen close to the current playback position. See <a href="#track-buffer-to-decoder-buffer">Track Buffer to Decoder Buffer transfer</a> for details.</p></dd>
-
           <dt id="random-access-point">Random Access Point</dt>
           <dd><p>A position in a <a href="#media-segment">media segment</a> where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams.</p></dd>
 
@@ -583,67 +580,8 @@
       </section>
     </section>
 
-
-    <section id="source-buffer-model">
-      <!--OddPage--><h2><span class="secno">2. </span>Source Buffer Model</h2>
-      <div class="nonnormative">
-        <p>The subsections below outline the buffering model for this specification. It describes the various rules and behaviors associated with appending
- data to an individual <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. At the highest level, the web application creates <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects and appends sequences of 
-<a href="#init-segment">initialization segments</a> and <a href="#media-segment">media segments</a> to update their state. The media element pulls media data out of the 
-<a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object, plays it, and fires events just like it would if a normal URL was passed to the <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#attr-media-src">src</a></code> attribute.
- The web application is expected to monitor media element events to determine when it needs to append more <a href="#media-segment">media segments</a>.</p>
-      </div>
-
-      <section id="source-buffer-overlapping-segments">
-        <h3><span class="secno">2.1 </span>Appending a Media Segment over a buffered region</h3>
-        <p>There are several ways that <a href="#media-segment">media segments</a> can overlap segments in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. Behavior for the different overlap situations are described below. If more than one overlap applies, then the <a href="#source-buffer-overlap-start">start overlap</a> must be resolved first, followed by any <a href="#source-buffer-overlap-complete">complete overlaps</a>, and finally the <a href="#source-buffer-overlap-end">end overlap</a>. If a segment contains multiple tracks then the overlap is resolved independently for each track.</p>
-
-        <div class="issue"><div class="issue-title"><span>Issue 1</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=19673">Bug 19673</a> - Seamless audio signal transitions at splice points</p></div>
-        <div class="issue"><div class="issue-title"><span>Issue 2</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=19784">Bug 19784</a> - timestampOffset with multiplexed Media Segments</p></div>
-
-        <section id="source-buffer-overlap-complete">
-          <h4><span class="secno">2.1.1 </span>Complete Overlap</h4>
-          <img src="complete_overlap.png" alt="Complete overlap diagram">
-          <p>The figure above shows how the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is updated when a new <a href="#media-segment">media segment</a> completely overlaps a segment in the buffer. In this case, the new segment completely replaces the old segment.</p>
-        </section>
-
-        <section id="source-buffer-overlap-start">
-          <h4><span class="secno">2.1.2 </span>Start Overlap</h4>
-          <img src="start_overlap.png" alt="Start overlap diagram">
-          <p>The figure above shows how the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is updated when the beginning of a new <a href="#media-segment">media segment</a> overlaps a segment in the buffer. In this case, the new segment replaces all the old media data in the overlapping region. Since <a href="#media-segment">media segments</a> are constrained to starting with <a href="#random-access-point">random access points</a>, this provides a seamless transition between segments.</p>
-          <p>When an audio frame in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> overlaps with the start of the new <a href="#media-segment">media segment</a> special behavior is required. At a minimum implementations must support dropping the old audio frame that overlaps the start of the new segment and insert silence for the small gap that is created. Higher quality implementations may support crossfading or crosslapping between the overlapping audio frames. No matter which strategy is implemented, no gaps are created in the ranges reported by <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> and playback must never stall at the overlap.</p>
-        </section>
-
-        <section id="source-buffer-overlap-end">
-          <h4><span class="secno">2.1.3 </span>End Overlap</h4>
-          <img src="end_overlap.png" alt="End overlap diagram">
-          <p>The figure above shows how the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is updated when the end of a new <a href="#media-segment">media segment</a> overlaps the beginning of a segment in the buffer. In this case, the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> tries to keep as much of the old segment as possible. The amount saved depends on where the closest <a href="#random-access-point">random access point</a>, in the old segment, is to the end of the new segment. In the case of audio, if the gap is smaller than the size of an audio frame, then the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> may render silence for this gap. This gap must not be reflect in <code><a href="#widl-SourceBuffer-buffered">buffered</a></code>. The entire new segment must be added to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>, but it is up to the implementation to determine how much of the old segment data is retained.</p>
-
-
-          <div class="note"><div class="note-title"><span>Note</span></div><p class="">An implementation may keep old segment data before the end of the new segment to avoid creating a gap if it wishes. Doing this though can significantly increase implementation complexity and could cause delays at the splice point.</p></div>
-
-          <div class="note"><div class="note-title"><span>Note</span></div><p class=""> The web application can use <code><a href="#widl-SourceBuffer-buffered">buffered</a></code> to determine how much of the old segment was preserved.</p></div>
-        </section>
-
-        <section id="source-buffer-overlap-middle">
-          <h4><span class="secno">2.1.4 </span>Middle Overlap</h4>
-          <img src="middle_overlap.png" alt="Middle overlap diagram">
-          <p>The figure above shows how the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is updated when the new <a href="#media-segment">media segment</a> is in the middle of the old segment. This condition is handled by first resolving the <a href="#source-buffer-overlap-start">start overlap</a> and then resolving the <a href="#source-buffer-overlap-end">end overlap</a>.</p>
-        </section>
-      </section>
-
-      <section id="track-buffer-to-decoder-buffer">
-        <h3><span class="secno">2.2 </span>Track Buffer to Decoder Buffer transfer</h3>
-        <div class="nonnormative">
-        <p>The <a href="#track-buffer">track buffer</a> represents the media that the web application would like the media element to play. The <a href="#decoder-buffer">decoder buffer</a> contains the data that will actually get decoded and rendered. In most cases the <a href="#decoder-buffer">decoder buffer</a> will simply contain a subset of the <a href="#track-buffer">track buffer</a> near the current playback position. These two buffers start to diverge when <a href="#media-segment">media segments</a> that overlap or are very close to the current playback position are appended. Depending on the contents of the new <a href="#media-segment">media segment</a> it may not be possible to switch to the new data immediately because there isn't a <a href="#random-access-point">random access point</a> close enough to the current playback position. The quality of the implementation determines how much data is considered "in the <a href="#decoder-buffer">decoder buffer</a>." It should transfer data to the <a href="#decoder-buffer">decoder buffer</a> as late as possible whilst maintaining seamless playback. Some implementations may be able to instantiate multiple decoders or decode the new data significantly faster than real-time to achieve a seamless splice immediately. Other implementations may delay until the next <a href="#random-access-point">random access point</a> before switching to the newly appended data. Notice that this difference in behavior is only observable when appending close to the current playback position. The <a href="#decoder-buffer">decoder buffer</a> represents a media subsegment, like a group of pictures or something with similar decode dependencies, that the media element commits to playing. This commitment may be influenced by a variety of things like limited decoding resources, hardware decode buffers, a jitter buffer, or the desire to limit implementation complexity.</p>
-
-        <p>Here is an example to help clarify the role of the <a href="#decoder-buffer">decoder buffer</a>. Say the current playback position has a timestamp of 8 and the media element pulled frames with timestamp 9 &amp; 10 into the decoder buffer. The web application then appends a higher quality <a href="#media-segment">media segment</a> that starts with a <a href="#random-access-point">random access point</a> at timestamp 9. The <a href="#track-buffer">track buffer</a> will get updated with the higher quality data, but the media element won't be able to switch to this higher quality data until the next <a href="#random-access-point">random access point</a> at timestamp 20. This is because a frame for timestamp 9 is already in the decoder buffer. The decoder buffer represents the "point of no return." for decoding. If a seek occurs the media element may choose to use the higher quality data since a seek might imply flushing the <a href="#decoder-buffer">decoder buffer</a> and the user expects a break in playback.</p>
-        </div>
-      </section>
-    </section>
-
     <section id="mediasource">
-      <!--OddPage--><h2><span class="secno">3. </span>MediaSource Object</h2>
+      <!--OddPage--><h2><span class="secno">2. </span>MediaSource Object</h2>
       <p>The MediaSource object represents a source of media data for an HTMLMediaElement. It keeps track of the <code><a href="#widl-MediaSource-readyState">readyState</a></code> for this source as well as a list of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects that can be used to add media data to the presentation. MediaSource objects are created by the web application and then attached to an HTMLMediaElement. The application uses the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> to add media data to this source. The HTMLMediaElement fetches this media data from the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object when it is needed during playback.</p>
 
       <pre class="idl"><span class="idlEnum" id="idl-def-ReadyState">enum <span class="idlEnumID">ReadyState</span> {
@@ -679,7 +617,7 @@
 <span class="idlMethod">    <span class="idlMethType"><a>void</a></span>           <span class="idlMethName"><a href="#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer">removeSourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a></span> <span class="idlParamName">sourceBuffer</span></span>);</span>
 <span class="idlMethod">    <span class="idlMethType"><a>void</a></span>           <span class="idlMethName"><a href="#widl-MediaSource-endOfStream-void-EndOfStreamError-error">endOfStream</a></span> (<span class="idlParam">optional <span class="idlParamType"><a href="#idl-def-EndOfStreamError" class="idlType"><code>EndOfStreamError</code></a></span> <span class="idlParamName">error</span></span>);</span>
 <span class="idlMethod">    static <span class="idlMethType"><a>boolean</a></span> <span class="idlMethName"><a href="#widl-MediaSource-isTypeSupported-boolean-DOMString-type">isTypeSupported</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">type</span></span>);</span>
-};</span></pre><section id="attributes"><h3><span class="secno">3.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-MediaSource-activeSourceBuffers"><code>activeSourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly</dt><dd>
+};</span></pre><section id="attributes"><h3><span class="secno">2.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-MediaSource-activeSourceBuffers"><code>activeSourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly</dt><dd>
           <p>Contains the subset of <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code> that are providing the 
             <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected video track</a>,  the 
             <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled audio tracks</a>, and the 
@@ -707,7 +645,7 @@
           <p>Indicates the current state of the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object. When the <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is created <code><a href="#widl-MediaSource-readyState">readyState</a></code> must be set to <code><a href="#idl-def-ReadyState">"closed"</a></code>.
         </p></dd><dt id="widl-MediaSource-sourceBuffers"><code>sourceBuffers</code> of type <span class="idlAttrType"><a href="#idl-def-SourceBufferList" class="idlType"><code>SourceBufferList</code></a></span>, readonly</dt><dd>
           Contains the list of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects associated with this <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a>. When <code><a href="#widl-MediaSource-readyState">readyState</a></code> equals <code><a href="#idl-def-ReadyState">"closed"</a></code> this list will be empty. Once <code><a href="#widl-MediaSource-readyState">readyState</a></code> transitions to <code><a href="#idl-def-ReadyState">"open"</a></code> SourceBuffer objects can be added to this list by using <code><a href="#widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type">addSourceBuffer()</a></code>.
-        </dd></dl></section><section id="methods"><h3><span class="secno">3.2 </span>Methods</h3><dl class="methods"><dt id="widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type"><code>addSourceBuffer</code></dt><dd>
+        </dd></dl></section><section id="methods"><h3><span class="secno">2.2 </span>Methods</h3><dl class="methods"><dt id="widl-MediaSource-addSourceBuffer-SourceBuffer-DOMString-type"><code>addSourceBuffer</code></dt><dd>
           <p>Adds a new <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> to <code><a href="#widl-MediaSource-sourceBuffers">sourceBuffers</a></code>.</p>
 
           
@@ -824,7 +762,7 @@
           </ol></dd></dl></section>
 
       <section id="mediasource-events">
-        <h3><span class="secno">3.3 </span>Event Summary</h3>
+        <h3><span class="secno">2.3 </span>Event Summary</h3>
         <table class="old-table">
           <thead>
             <tr>
@@ -854,10 +792,10 @@
       </section>
 
       <section id="mediasource-algorithms">
-        <h3><span class="secno">3.4 </span>Algorithms</h3>
+        <h3><span class="secno">2.4 </span>Algorithms</h3>
 
         <section id="mediasource-attach">
-          <h4><span class="secno">3.4.1 </span>Attaching to a media element</h4>
+          <h4><span class="secno">2.4.1 </span>Attaching to a media element</h4>
           <p> A <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> object can be attached to a media element by assigning a <a href="#mediasource-object-url">MediaSource object URL</a> to the media element <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#attr-media-src">src</a></code> attribute or the src attribute of a &lt;source&gt; inside a media element. A <a href="#mediasource-object-url">MediaSource object URL</a> is created by passing a MediaSource object to <code><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL()</a></code>.</p>
           <p>If the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a> absolute URL matches the MediaSource object URL, run the following steps right before the "Perform a potentially
             CORS-enabled fetch" step in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</p>
@@ -878,7 +816,7 @@
         </section>
 
         <section id="mediasource-detach">
-          <h4><span class="secno">3.4.2 </span>Detaching from a media element</h4>
+          <h4><span class="secno">2.4.2 </span>Detaching from a media element</h4>
           <p>The following steps are run in any case where the media element is going to transition to <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-network_empty">NETWORK_EMPTY</a> and <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-mediacontroller-emptied">emptied</a> at the media element. These steps should be run right before the transition.</p>
           <ol>
             <li>Set the <code><a href="#widl-MediaSource-readyState">readyState</a></code> attribute to <code><a href="#idl-def-ReadyState">"closed"</a></code>.</li>
@@ -895,7 +833,7 @@
         </section>
 
         <section id="mediasource-seeking">
-          <h4><span class="secno">3.4.3 </span>Seeking</h4>
+          <h4><span class="secno">2.4.3 </span>Seeking</h4>
           <p>Run the following steps as part of the "<i>Wait until the user agent has established whether or not the media data for the new playback position is available, and, if it is, until it has decoded enough data to play back that position"</i> step of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seek">seek algorithm</a>:</p>
           <ol>
             <li>The media element looks for <a href="#media-segment">media segments</a> containing the <var>new playback position</var> in each <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code>.
@@ -922,7 +860,7 @@
 
 
         <section id="buffer-monitoring">
-          <h4><span class="secno">3.4.4 </span>SourceBuffer Monitoring</h4>
+          <h4><span class="secno">2.4.4 </span>SourceBuffer Monitoring</h4>
           <p>The following steps are periodically run during playback to make sure that all of the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> have <a href="#enough-data">enough data to ensure uninterrupted playback</a>. Appending new segments and changes to <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> also cause these steps to run because they affect the conditions that trigger state transitions.</p>
 
           <p>Having <dfn id="enough-data">enough data to ensure uninterrupted playback</dfn> is an implementation specific condition where the user agent
@@ -980,7 +918,7 @@
         </section>
 
         <section id="active-source-buffer-changes">
-          <h4><span class="secno">3.4.5 </span>Changes to selected/enabled track state</h4>
+          <h4><span class="secno">2.4.5 </span>Changes to selected/enabled track state</h4>
           <p>During playback <code><a href="#widl-MediaSource-activeSourceBuffers">activeSourceBuffers</a></code> needs to be updated if the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-selected">selected video track</a>, the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-enabled">enabled audio tracks</a>, or a text track <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-mode">mode</a> changes. When one or more of these changes occur the following steps need to be followed.</p>
           <dl class="switch">
             <dt>If the selected video track changes, then run the following steps:</dt>
@@ -1050,7 +988,7 @@
         </section>
 
         <section id="duration-change-algorithm">
-          <h4><span class="secno">3.4.6 </span>Duration change</h4>
+          <h4><span class="secno">2.4.6 </span>Duration change</h4>
           <p>Follow these steps when <code><a href="#widl-MediaSource-duration">duration</a></code> needs to change to a <var>new duration</var>.</p>
           <ol>
             <li>If the current value of <code><a href="#widl-MediaSource-duration">duration</a></code> is equal to <var>new duration</var>, then abort these steps.</li>
@@ -1067,9 +1005,7 @@
     </section>
 
     <section id="sourcebuffer">
-      <!--OddPage--><h2><span class="secno">4. </span>SourceBuffer Object</h2>
-
-      <div class="issue"><div class="issue-title"><span>Issue 3</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20327">Bug 20327</a> - Continuous splice flag</p></div>
+      <!--OddPage--><h2><span class="secno">3. </span>SourceBuffer Object</h2>
 
       <pre class="idl"><span class="idlInterface" id="idl-def-SourceBuffer">interface <span class="idlInterfaceID">SourceBuffer</span> : <span class="idlSuperclass"><a>EventTarget</a></span> {
 <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>boolean</a></span>        <span class="idlAttrName"><a href="#widl-SourceBuffer-updating">updating</a></span>;</span>
@@ -1082,7 +1018,7 @@
 <span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream</a></span> (<span class="idlParam"><span class="idlParamType"><a>Stream</a></span> <span class="idlParamName">stream</span></span>, <span class="idlParam">optional <span class="idlParamType"><a>unsigned long long</a></span> <span class="idlParamName">maxSize</span></span>);</span>
 <span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-SourceBuffer-abort-void">abort</a></span> ();</span>
 <span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-SourceBuffer-remove-void-double-start-double-end">remove</a></span> (<span class="idlParam"><span class="idlParamType"><a>double</a></span> <span class="idlParamName">start</span></span>, <span class="idlParam"><span class="idlParamType"><a>double</a></span> <span class="idlParamName">end</span></span>);</span>
-};</span></pre><section id="attributes-1"><h3><span class="secno">4.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBuffer-audioTracks"><code>audioTracks</code> of type <span class="idlAttrType"><a>AudioTrackList</a></span>, readonly</dt><dd>
+};</span></pre><section id="attributes-1"><h3><span class="secno">3.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBuffer-audioTracks"><code>audioTracks</code> of type <span class="idlAttrType"><a>AudioTrackList</a></span>, readonly</dt><dd>
           The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> objects created by this object.
         </dd><dt id="widl-SourceBuffer-buffered"><code>buffered</code> of type <span class="idlAttrType"><a>TimeRanges</a></span>, readonly</dt><dd>
           <p>Indicates what <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#timeranges">TimeRanges</a></code> are buffered in the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p>
@@ -1116,7 +1052,7 @@
             processed.</p>
         </dd><dt id="widl-SourceBuffer-videoTracks"><code>videoTracks</code> of type <span class="idlAttrType"><a>VideoTrackList</a></span>, readonly</dt><dd>
           The list of <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> objects created by this object.
-        </dd></dl></section><section id="methods-1"><h3><span class="secno">4.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBuffer-abort-void"><code>abort</code></dt><dd>
+        </dd></dl></section><section id="methods-1"><h3><span class="secno">3.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBuffer-abort-void"><code>abort</code></dt><dd>
           <p>Aborts the current segment and resets the segment parser.</p>
 
           
@@ -1226,7 +1162,7 @@
        </ol></dd></dl></section>
 
       <section id="track-buffers">
-        <h3><span class="secno">4.3 </span>Track Buffers</h3>
+        <h3><span class="secno">3.3 </span>Track Buffers</h3>
         <p>A <dfn id="track-buffer">track buffer</dfn> stores the <a href="#track-description">track descriptions</a> and <a href="#coded-frame">coded frames</a> for an individual
           track. The track buffer is updated as <a href="#init-segment">initialization segments</a> and <a href="#media-segment">media segments</a> are appended to the 
           <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>.</p>
@@ -1238,10 +1174,15 @@
         <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="highest-presentation-timestamp">highest presentation timestamp</dfn> variable that stores
           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>.
           The variable is initially unset to indicate that no <a href="#coded-frame">coded frames</a> have been appended yet.</p>
+
+         <p>Each <a href="#track-buffer">track buffer</a> has a <dfn id="need-RAP-flag">need random access point flag</dfn> variable that keeps track of whether
+           the track buffer is waiting for a <a href="#random-access-point">random access point</a> <a href="#coded-frame">coded frame</a>. The variable is initially set to true to
+           indicate that <a href="#random-access-point">random access point</a> <a href="#coded-frame">coded frame</a> is needed before anything can be added to the
+           <a href="#track-buffer">track buffer</a>.</p>
       </section>
 
       <section id="sourcebuffer-events">
-        <h3><span class="secno">4.4 </span>Event Summary</h3>
+        <h3><span class="secno">3.4 </span>Event Summary</h3>
         <table class="old-table">
           <thead>
             <tr>
@@ -1281,10 +1222,10 @@
       </section>
 
       <section id="sourcebuffer-algorithms">
-        <h3><span class="secno">4.5 </span>Algorithms</h3>
+        <h3><span class="secno">3.5 </span>Algorithms</h3>
 
         <section id="sourcebuffer-segment-parser-loop">
-          <h4><span class="secno">4.5.1 </span>Segment Parser Loop</h4>
+          <h4><span class="secno">3.5.1 </span>Segment Parser Loop</h4>
           <p>All SourceBuffer objects have an internal <dfn id="sourcebuffer-append-state">append state</dfn> variable that keeps track of the high-level segment parsing state. It is initially set to <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a> and can transition to the following states as data is appended.</p>
           <table class="old-table">
             <thead>
@@ -1362,19 +1303,20 @@
         </section>
 
         <section id="sourcebuffer-reset-parser-state">
-          <h4><span class="secno">4.5.2 </span>Reset Parser State</h4>
+          <h4><span class="secno">3.5.2 </span>Reset Parser State</h4>
           <p>When the parser state needs to be reset, run the following steps:</p>
           <ol>
             <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>
             <li>Unset the <var><a href="#last-decode-timestamp">last decode timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
             <li>Unset the <var><a href="#highest-presentation-timestamp">highest presentation timestamp</a></var> on all <a href="#track-buffer">track buffers</a>.</li>
+            <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>
             <li>Remove all bytes from the <var><a href="#sourcebuffer-input-buffer">input buffer</a></var>.</li>
             <li>Set <var><a href="#sourcebuffer-append-state">append state</a></var> to <a href="#sourcebuffer-waiting-for-segment">WAITING_FOR_SEGMENT</a>.</li>
           </ol>
         </section>
 
         <section id="sourcebuffer-append-error">
-          <h4><span class="secno">4.5.3 </span>Append Error</h4>
+          <h4><span class="secno">3.5.3 </span>Append Error</h4>
           <p>When an error occurs during an append, run the following steps:</p>
           <ol>
             <li>Run the <a href="#sourcebuffer-reset-parser-state">reset parser state algorithm</a>.</li>
@@ -1382,14 +1324,14 @@
             <li>Set the <code><a href="#widl-SourceBuffer-updating">updating</a></code> attribute to false.</li>
             <li>
               <a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-error">error</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.
-              <div class="issue"><div class="issue-title"><span>Issue 4</span></div><p class="">Need a way to convey error information.</p></div>
+              <div class="issue"><div class="issue-title"><span>Issue 1</span></div><p class="">Need a way to convey error information.</p></div>
             </li>
             <li><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-evt-updateend">updateend</a></code> at this <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> object.</li>
           </ol>
         </section>
 
         <section id="sourcebuffer-stream-append-loop">
-          <h4><span class="secno">4.5.4 </span>Stream Append Loop</h4>
+          <h4><span class="secno">3.5.4 </span>Stream Append Loop</h4>
           <p>When a <a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a> is passed to <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code>, the following steps are run to transfer data from the
             <a href="http://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm#idl-def-Stream">Stream</a> to the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. This algorithm is initialized with the  <var>stream</var> and <var>maxSize</var> parameters
             from the <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> call.
@@ -1426,7 +1368,7 @@
         </section>
 
         <section id="sourcebuffer-init-segment-received">
-          <h4><span class="secno">4.5.5 </span>Initialization Segment Received</h4>
+          <h4><span class="secno">3.5.5 </span>Initialization Segment Received</h4>
           <p>The following steps are run when the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> successfully parses a complete <a href="#init-segment">initialization segment</a>:</p>
           <p>Each SourceBuffer object has an internal <dfn id="first-init-segment-flag">first initialization segment flag</dfn> that tracks whether the first <a href="#init-segment">initialization segment</a> has been appended. This flag is set to false when the SourceBuffer is created and updated by the algorithm below.</p>
           <ol>
@@ -1555,7 +1497,7 @@
         </section>
 
         <section id="sourcebuffer-coded-frame-processing">
-          <h4><span class="secno">4.5.6 </span>Coded Frame Processing</h4>
+          <h4><span class="secno">3.5.6 </span>Coded Frame Processing</h4>
           <p>When complete <a href="#coded-frame">coded frames</a> have been parsed by the <a href="#sourcebuffer-segment-parser-loop">segment parser loop</a> then the following steps are run:</p>
           <ol>
             <li>
@@ -1589,6 +1531,13 @@
                 </li>
 
                 <li>Let <var>frame end timestamp</var> equal the sum of <var>presentation timestamp</var> and <var>frame duration</var>.</li>
+                <li>If the <var><a href="#need-RAP-flag">need random access point flag</a></var> on <var>track buffer</var> equals true, then run the following steps:
+                  <ol>
+                    <li>If the coded frame is not a <a href="#random-access-point">random access point</a>, then drop the coded frame and jump to the top of the loop to start
+                      processing the next coded frame.</li>
+                    <li>Set the <var><a href="#need-RAP-flag">need random access point flag</a></var> on <var>track buffer</var> to false.</li>
+                  </ol>
+                </li>
                 <li>Let <var>spliced frame</var> be an unset variable for holding audio splice information</li>
                 <li>If <var><a href="#last-decode-timestamp">last decode timestamp</a></var> for <var>track buffer</var> is unset and <var>presentation timestamp</var> lies within a
                   <a href="#coded-frame">coded frame</a> already stored in <var>track buffer</var>, then run the following steps:
@@ -1667,7 +1616,7 @@
         </section>
 
         <section id="sourcebuffer-audio-splice-frame-algorithm">
-          <h4><span class="secno">4.5.7 </span>Audio Splice Frame Algorithm</h4>
+          <h4><span class="secno">3.5.7 </span>Audio Splice Frame Algorithm</h4>
           <p>Follow these steps when the <a href="#sourcebuffer-coded-frame-processing">coded frame processing algorithm</a> needs to generate a splice frame for two overlapping audio
             <a href="#coded-frame">coded frames</a>:</p>
           <ol>
@@ -1727,7 +1676,7 @@
           </ol>
         </section>
         <section id="sourcebuffer-audio-splice-rendering-algorithm">
-          <h4><span class="secno">4.5.8 </span>Audio Splice Rendering Algorithm</h4>
+          <h4><span class="secno">3.5.8 </span>Audio Splice Rendering Algorithm</h4>
           <p>The following steps are run when a spliced frame, generated by the <a href="#sourcebuffer-audio-splice-frame-algorithm">audio splice frame algorithm</a>, needs to be rendered by the 
             media element:</p>
           <ol>
@@ -1760,15 +1709,15 @@
     </section>
 
     <section id="sourcebufferlist">
-      <!--OddPage--><h2><span class="secno">5. </span>SourceBufferList Object</h2>
+      <!--OddPage--><h2><span class="secno">4. </span>SourceBufferList Object</h2>
       <p>SourceBufferList is a simple container object for <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects. It provides read-only array access and fires events when the list is modified.</p>
 
       <pre class="idl"><span class="idlInterface" id="idl-def-SourceBufferList">interface <span class="idlInterfaceID">SourceBufferList</span> : <span class="idlSuperclass"><a>EventTarget</a></span> {
 <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>unsigned long</a></span> <span class="idlAttrName"><a href="#widl-SourceBufferList-length">length</a></span>;</span>
 <span class="idlMethod">    <span class="idlMethType"><a>getter</a></span> <span class="idlMethName"><a href="#widl-SourceBufferList-SourceBuffer-getter-unsigned-long-index">SourceBuffer</a></span> (<span class="idlParam"><span class="idlParamType"><a>unsigned long</a></span> <span class="idlParamName">index</span></span>);</span>
-};</span></pre><section id="attributes-2"><h3><span class="secno">5.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBufferList-length"><code>length</code> of type <span class="idlAttrType"><a>unsigned long</a></span>, readonly</dt><dd>
+};</span></pre><section id="attributes-2"><h3><span class="secno">4.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-SourceBufferList-length"><code>length</code> of type <span class="idlAttrType"><a>unsigned long</a></span>, readonly</dt><dd>
           <p>Indicates the number of <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> objects in the list.</p>
-        </dd></dl></section><section id="methods-2"><h3><span class="secno">5.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBufferList-SourceBuffer-getter-unsigned-long-index"><code>SourceBuffer</code></dt><dd>
+        </dd></dl></section><section id="methods-2"><h3><span class="secno">4.2 </span>Methods</h3><dl class="methods"><dt id="widl-SourceBufferList-SourceBuffer-getter-unsigned-long-index"><code>SourceBuffer</code></dt><dd>
           <p>Allows the SourceBuffer objects in the list to be accessed with an array operator (i.e. []).</p>
 
           
@@ -1778,7 +1727,7 @@
           </ol></dd></dl></section>
 
       <section id="sourcebufferlist-events">
-        <h3><span class="secno">5.3 </span>Event Summary</h3>
+        <h3><span class="secno">4.3 </span>Event Summary</h3>
         <table class="old-table">
           <thead>
             <tr>
@@ -1804,12 +1753,12 @@
     </section>
 
     <section id="url">
-      <!--OddPage--><h2><span class="secno">6. </span>URL Object</h2>
+      <!--OddPage--><h2><span class="secno">5. </span>URL Object</h2>
       <p></p>
 
       <pre class="idl"><span class="idlInterface" id="idl-def-URL">partial interface <span class="idlInterfaceID">URL</span> {
 <span class="idlMethod">    static <span class="idlMethType"><a>DOMString</a></span> <span class="idlMethName"><a href="#widl-URL-createObjectURL-DOMString-MediaSource-mediaSource">createObjectURL</a></span> (<span class="idlParam"><span class="idlParamType"><a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a></span> <span class="idlParamName">mediaSource</span></span>);</span>
-};</span></pre><section id="methods-3"><h3><span class="secno">6.1 </span>Methods</h3><dl class="methods"><dt id="widl-URL-createObjectURL-DOMString-MediaSource-mediaSource"><code>createObjectURL</code>, static</dt><dd>
+};</span></pre><section id="methods-3"><h3><span class="secno">5.1 </span>Methods</h3><dl class="methods"><dt id="widl-URL-createObjectURL-DOMString-MediaSource-mediaSource"><code>createObjectURL</code>, static</dt><dd>
           <p>Creates URLs for <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> objects.</p>
 
           
@@ -1823,7 +1772,7 @@
     </section>
 
     <section id="htmlmediaelement-attributes">
-      <!--OddPage--><h2><span class="secno">7. </span>HTMLMediaElement attributes</h2>
+      <!--OddPage--><h2><span class="secno">6. </span>HTMLMediaElement attributes</h2>
       <p>This section specifies what existing attributes on the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement">HTMLMediaElement</a> should return when a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> is attached to the element.</p>
 
       <p>The <a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seekable">HTMLMediaElement.seekable</a> attribute returns a new static <a href="http://www.w3.org/TR/html5/embedded-content-0.html#normalized-timeranges-object">normalized TimeRanges object</a> created based on the following steps:</p>
@@ -1856,14 +1805,14 @@
     </section>
 
     <section id="audio-track-extensions">
-      <!--OddPage--><h2><span class="secno">8. </span>AudioTrack Extensions</h2>
+      <!--OddPage--><h2><span class="secno">7. </span>AudioTrack Extensions</h2>
       <p>This section specifies extensions to the HTML <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#audiotrack">AudioTrack</a></code> definition.</p>
 
       <pre class="idl"><span class="idlInterface" id="idl-def-AudioTrack">partial interface <span class="idlInterfaceID">AudioTrack</span> {
 <span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span>     <span class="idlAttrName"><a href="#widl-AudioTrack-kind">kind</a></span>;</span>
 <span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span>     <span class="idlAttrName"><a href="#widl-AudioTrack-language">language</a></span>;</span>
 <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>?</span> <span class="idlAttrName"><a href="#widl-AudioTrack-sourceBuffer">sourceBuffer</a></span>;</span>
-};</span></pre><section id="attributes-3"><h3><span class="secno">8.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-AudioTrack-kind"><code>kind</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
+};</span></pre><section id="attributes-3"><h3><span class="secno">7.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-AudioTrack-kind"><code>kind</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
           <p>Allows the web application to get and update the track <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-audiotrack-kind">kind</a></code>.</p>
           <p>On getting, return the current value of the attribute. This is either the value provided when this object was created or the value provided on
             the last successful set operation.</p><p>
@@ -1901,14 +1850,14 @@
     </section>
 
     <section id="video-track-extensions">
-      <!--OddPage--><h2><span class="secno">9. </span>VideoTrack Extensions</h2>
+      <!--OddPage--><h2><span class="secno">8. </span>VideoTrack Extensions</h2>
       <p>This section specifies extensions to the HTML <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#videotrack">VideoTrack</a></code> definition.</p>
 
       <pre class="idl"><span class="idlInterface" id="idl-def-VideoTrack">partial interface <span class="idlInterfaceID">VideoTrack</span> {
 <span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span>     <span class="idlAttrName"><a href="#widl-VideoTrack-kind">kind</a></span>;</span>
 <span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span>     <span class="idlAttrName"><a href="#widl-VideoTrack-language">language</a></span>;</span>
 <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>?</span> <span class="idlAttrName"><a href="#widl-VideoTrack-sourceBuffer">sourceBuffer</a></span>;</span>
-};</span></pre><section id="attributes-4"><h3><span class="secno">9.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-VideoTrack-kind"><code>kind</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
+};</span></pre><section id="attributes-4"><h3><span class="secno">8.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-VideoTrack-kind"><code>kind</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
           <p>Allows the web application to get and update the track <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-videotrack-kind">kind</a></code>.</p>
           <p>On getting, return the current value of the attribute. This is either the value provided when this object was created or the value provided on
             the last successful set operation.</p><p>
@@ -1945,14 +1894,14 @@
         </dd></dl></section></section>
 
     <section id="text-track-extensions">
-      <!--OddPage--><h2><span class="secno">10. </span>TextTrack Extensions</h2>
+      <!--OddPage--><h2><span class="secno">9. </span>TextTrack Extensions</h2>
       <p>This section specifies extensions to the HTML <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#texttrack">TextTrack</a></code> definition.</p>
 
       <pre class="idl"><span class="idlInterface" id="idl-def-TextTrack">partial interface <span class="idlInterfaceID">TextTrack</span> {
 <span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span>     <span class="idlAttrName"><a href="#widl-TextTrack-kind">kind</a></span>;</span>
 <span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a></span>     <span class="idlAttrName"><a href="#widl-TextTrack-language">language</a></span>;</span>
 <span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>?</span> <span class="idlAttrName"><a href="#widl-TextTrack-sourceBuffer">sourceBuffer</a></span>;</span>
-};</span></pre><section id="attributes-5"><h3><span class="secno">10.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-TextTrack-kind"><code>kind</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
+};</span></pre><section id="attributes-5"><h3><span class="secno">9.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-TextTrack-kind"><code>kind</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
           <p>Allows the web application to get and update the track <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#dom-texttrack-kind">kind</a></code>.</p>
           <p>On getting, return the current value of the attribute. This is either the value provided when this object was created or the value provided on
             the last successful set operation.</p><p>
@@ -1990,7 +1939,7 @@
         </dd></dl></section></section>
 
     <section id="byte-stream-formats">
-      <!--OddPage--><h2><span class="secno">11. </span>Byte Stream Formats</h2>
+      <!--OddPage--><h2><span class="secno">10. </span>Byte Stream Formats</h2>
       <p>The bytes provided through <code><a href="#widl-SourceBuffer-appendArrayBuffer-void-ArrayBuffer-data">appendArrayBuffer()</a></code> and <code><a href="#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-maxSize">appendStream()</a></code> for a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> form a logical byte stream. The format of this byte stream depends on the media container format in use and is defined in a byte stream format specification. Byte stream format specifications based on WebM , the ISO Base Media File Format, and MPEG-2 Transport Streams are provided below. These format specifications are intended to be the authoritative source for how data from these containers is formatted and passed to a <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a>. If a <a href="#idl-def-MediaSource" class="idlType"><code>MediaSource</code></a> implementation claims to support any of these container formats, then it must implement the corresponding byte stream format specification described below.</p>
       <p>This section provides general requirements for all byte stream formats:</p>
       <ul>
@@ -2024,7 +1973,6 @@
         <li>The following rules apply to all <a href="#media-segment">media segments</a> within a byte stream:
           <ol>
             <li>All timestamps must be mapped to the same presentation timeline.</li>
-	    <li>Segments must start with a <a href="#random-access-point">random access point</a> to facilitate seamless splicing at the segment boundary.</li>
 	    <li>Gaps between <a href="#media-segment">media segments</a> that are smaller than the audio frame size are allowed and must not cause playback to stall. Such gaps must not be reflected by <code><a href="#widl-SourceBuffer-buffered">buffered</a></code>.
 	      <div class="note"><div class="note-title"><span>Note</span></div><p class="">This is intended to simplify switching between audio streams where the frame boundaries don't always line up across encodings (e.g. Vorbis).</p></div>
             </li>
@@ -2049,11 +1997,11 @@
       <p>Byte stream specifications must at a minimum define constraints which ensure that the above requirements hold. Additional constraints may be defined, for example to simplify implementation.</p>
 
       <section id="webm" class="nonnormative">
-        <h3><span class="secno">11.1 </span>WebM Byte Streams</h3>
+        <h3><span class="secno">10.1 </span>WebM Byte Streams</h3>
         <p>This section defines segment formats for implementations that choose to support WebM.</p>
 
         <section id="webm-init-segments">
-          <h4><span class="secno">11.1.1 </span>Initialization Segments</h4>
+          <h4><span class="secno">10.1.1 </span>Initialization Segments</h4>
           <p>A WebM <a href="#init-segment">initialization segment</a> must contain a subset of the elements at the start of a typical WebM file.</p>
           <p>The following rules apply to WebM initialization segments:</p>
           <ol>
@@ -2065,7 +2013,7 @@
         </section>
 
         <section id="webm-media-segments">
-          <h4><span class="secno">11.1.2 </span>Media Segments</h4>
+          <h4><span class="secno">10.1.2 </span>Media Segments</h4>
           <p>A WebM <a href="#media-segment">media segment</a> is a single <a href="http://www.webmproject.org/code/specs/container/#cluster">Cluster</a> element.</p>
           <p>The following rules apply to WebM media segments:</p>
           <ol>
@@ -2081,18 +2029,18 @@
         </section>
 
         <section id="webm-random-access-points">
-          <h4><span class="secno">11.1.3 </span>Random Access Points</h4>
+          <h4><span class="secno">10.1.3 </span>Random Access Points</h4>
           <p>A SimpleBlock element with its Keyframe flag set signals the location of a <a href="#random-access-point">random access point</a> for that track. Media segments containing multiple tracks are only considered a random access point if the first SimpleBlock for each track has its Keyframe flag set. The order of the multiplexed blocks must conform to the <a href="http://www.webmproject.org/code/specs/container/#muxer-guidelines">WebM Muxer Guidelines</a>.</p>
         </section>
       </section>
       
       <section id="iso" class="nonnormative">
-        <h3><span class="secno">11.2 </span>ISO Base Media File Format Byte Streams</h3>
+        <h3><span class="secno">10.2 </span>ISO Base Media File Format Byte Streams</h3>
         <p>This section defines segment formats for implementations that choose to support the ISO Base Media File Format
 	  <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip">ISO/IEC 14496-12</a> (ISO BMFF).</p> 
 
 	<section id="iso-init-segments">
-          <h4><span class="secno">11.2.1 </span>Initialization Segments</h4>
+          <h4><span class="secno">10.2.1 </span>Initialization Segments</h4>
           <p>An ISO BMFF <a href="#init-segment">initialization segment</a> is defined in this specification as a single Movie Header Box (<span class="iso-box">moov</span>).
             The tracks in the  Movie Header Box must not contain any samples (i.e. the <span class="iso-var">entry_count</span> in the
             <span class="iso-box">stts</span>, <span class="iso-box">stsc</span> and <span class="iso-box">stco</span> boxes must be set to zero). A Movie
@@ -2105,7 +2053,7 @@
 	</section>
         
 	<section id="iso-media-segments">
-          <h4><span class="secno">11.2.2 </span>Media Segments</h4>
+          <h4><span class="secno">10.2.2 </span>Media Segments</h4>
           <p>An ISO BMFF <a href="#media-segment">media segment</a> is defined in this specification as a single Movie Fragment Box
             (<span class="iso-box">moof</span>) followed by one or more Media Data Boxes (<span class="iso-box">mdat</span>).</p>
           <p>Valid top-level boxes defined in <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip">ISO/IEC 14496-12</a> other than <span class="iso-box">moov</span>, 
@@ -2121,24 +2069,23 @@
 	    <li>External data references must not be used.</li>
 	    <li>If the Movie Fragment contains multiple tracks, the duration by which each track extends should be as close to equal as practical.</li>
 	    <li>Each Track Fragment Box must contain a Track Fragment Decode Time Box (<span class="iso-box">tfdt</span>)</li>
-	    <li>The first sample in each Track Fragment Run Box (<span class="iso-box">trun</span>) must indicate that the sample is a <a href="#random-access-point">random access point</a>.</li>
 	    <li>The Media Data Boxes must contain all the samples referenced by the Track Fragment Run Boxes (<span class="iso-box">trun</span>) of the Movie Fragment Box.</li>
           </ol>
 	</section>
 
 	<section id="iso-random-access-points">
-          <h4><span class="secno">11.2.3 </span>Random Access Points</h4>
+          <h4><span class="secno">10.2.3 </span>Random Access Points</h4>
           <p>A <a href="#random-access-point">random access point</a> as defined in this specification corresponds to a Stream Access Point of type 1 or 2 as defined in Annex I of <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c061988_ISO_IEC_14496-12_2012.zip">ISO/IEC 14496-12</a>.</p>
 	</section>
       </section>
 
       <section id="mpeg2ts" class="nonnormative">
-        <h3><span class="secno">11.3 </span>MPEG-2 Transport Stream Byte Streams</h3>
+        <h3><span class="secno">10.3 </span>MPEG-2 Transport Stream Byte Streams</h3>
         <p>This section defines segment formats for implementations that choose to support MPEG-2 Transport Streams
           (MPEG-2 TS) specified in <a href="http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=44169">ISO/IEC 13818-1</a>.</p>
         
         <section id="mpeg2ts-general">
-          <h4><span class="secno">11.3.1 </span>General</h4>
+          <h4><span class="secno">10.3.1 </span>General</h4>
           <p>MPEG-2 TS media and initialization segments must conform to the MPEG-2 TS Adaptive Profile (ISO/IEC 13818-1:2012 Amd. 2).</p>
           <p>The following rules must apply to all MPEG-2 TS segments:</p>
           <ol>
@@ -2149,13 +2096,13 @@
           </ol>
         </section>
         <section id="mpeg2ts-init-segments">
-          <h4><span class="secno">11.3.2 </span>Initialization Segments</h4>
+          <h4><span class="secno">10.3.2 </span>Initialization Segments</h4>
           <p>An MPEG-2 TS initialization segment must contain a single PAT and a single PMT. Other SI, such as CAT, that are invariant for all subsequent
             media segments, may be present.</p>
         </section>
   
         <section id="mpeg2ts-media-segments">
-          <h4><span class="secno">11.3.3 </span>Media Segments</h4>
+          <h4><span class="secno">10.3.3 </span>Media Segments</h4>
           <p>The following rules apply to all MPEG-2 TS media segments:</p>
           <ol>
             <li>PSI that is identical to the information in the initialization segment may appear repeatedly throughout the segment.</li>
@@ -2168,12 +2115,12 @@
         </section>
 
         <section id="mpeg2ts-random-access-points">
-          <h4><span class="secno">11.3.4 </span>Random Access Points</h4>
+          <h4><span class="secno">10.3.4 </span>Random Access Points</h4>
           <p>A random access point as defined in this specification corresponds to Elementary Stream Random Access Point as defined in 
             <a href="http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=44169">ISO/IEC 13818-1</a>.</p>
         </section>
         <section id="mpeg2ts-discontinuities">
-          <h4><span class="secno">11.3.5 </span>Timestamp Rollover &amp; Discontinuities</h4>
+          <h4><span class="secno">10.3.5 </span>Timestamp Rollover &amp; Discontinuities</h4>
           <p>Timestamp rollovers and discontinuities must be handled by the UA. The UA's MPEG-2 TS implementation must maintain an internal offset
           variable, <dfn id="mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</dfn>, to keep track of the offset that needs to be applied to timestamps
           that have rolled over or are part of a discontinuity. <var>MPEG2TS_timestampOffset</var> is initially set to 0 when the <a href="#idl-def-SourceBuffer" class="idlType"><code>SourceBuffer</code></a> is 
@@ -2198,7 +2145,7 @@
 
 
     <section id="examples">
-      <!--OddPage--><h2><span class="secno">12. </span>Examples</h2>
+      <!--OddPage--><h2><span class="secno">11. </span>Examples</h2>
       <p>Example use of the Media Source Extensions</p>
       <div class="block">
         <div class="blockContent">
@@ -2241,7 +2188,7 @@
     }
 
     // Make sure the previous append is not still pending.
-    if (mediaSource.sourceBuffers[0].appending)
+    if (mediaSource.sourceBuffers[0].updating)
         return;
 
     var mediaSegment = GetNextMediaSegment();
@@ -2288,7 +2235,7 @@
     </section>
 
     <section id="revision-history">
-      <!--OddPage--><h2><span class="secno">13. </span>Revision History</h2>
+      <!--OddPage--><h2><span class="secno">12. </span>Revision History</h2>
       <table class="old-table">
         <thead>
           <tr>
@@ -2298,7 +2245,17 @@
         </thead>
         <tbody>
           <tr>
-            <td>19 February 2013</td>
+            <td>25 February 2013</td>
+            <td>
+              <ul>
+                 <li>Remove Source Buffer Model section since all the behavior is covered by the algorithms now.</li>
+                 <li>Bug 20899 - Remove media segments must start with a random access point requirement.</li>
+                 <li>Bug 21065 - Update example code to use updating attribute instead of old appending attribute.</li>
+              </ul>
+            </td>
+          </tr>
+          <tr>
+            <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/d5956e93b991/media-source/media-source.html">19 February 2013</a></td>
             <td>
               <ul>
                  <li>Bug 19676, 20327 - Provide more detail for audio &amp; video splicing.</li>
@@ -2311,7 +2268,7 @@
             </td>
           </tr>
           <tr>
-	    <td><a href="https://dvcs.w3.org/hg/html-media/raw-file/77975abeec41/media-source/media-source.html">05 February 2013</a></td>
+	    <td><a href="http://dvcs.w3.org/hg/html-media/raw-file/77975abeec41/media-source/media-source.html">05 February 2013</a></td>
             <td>
               <ul>
                 <li>Bug 19676 - Added a note clarifying that the internal timestamp representation doesn't have to be a double.</li>
--- a/media-source/media-source.js	Mon Feb 18 13:44:34 2013 -0800
+++ b/media-source/media-source.js	Mon Feb 25 10:35:43 2013 -0800
@@ -104,14 +104,12 @@
     'addsourcebuffer': { func: eventref_helper, fragment: 'addsourcebuffer', link_text: 'addsourcebuffer',  },
     'removesourcebuffer': { func: eventref_helper, fragment: 'removesourcebuffer', link_text: 'removesourcebuffer',  },
 
-    'decoder-buffer': { func: term_helper, fragment: 'decoder-buffer', link_text: 'decoder buffer', },
     'init-segment': { func: term_helper, fragment: 'init-segment', link_text: 'initialization segment', },
     'init-segments': { func: term_helper, fragment: 'init-segment', link_text: 'initialization segments', },
     'media-segment': { func: term_helper, fragment: 'media-segment', link_text: 'media segment', },
     'media-segments': { func: term_helper, fragment: 'media-segment', link_text: 'media segments', },
     'presentation-start-time': { func: term_helper, fragment: 'presentation-start-time', link_text: 'presentation start time', },
     'random-access-point': { func: term_helper, fragment: 'random-access-point', link_text: 'random access point', },
-    'random-access-points': { func: term_helper, fragment: 'random-access-point', link_text: 'random access points', },
     'track-id': { func: term_helper, fragment: 'track-id', link_text: 'Track ID', },
     'track-ids': { func: term_helper, fragment: 'track-id', link_text: 'Track IDs', },
     'track-description': { func: term_helper, fragment: 'track-description', link_text: 'track description', },
@@ -145,6 +143,7 @@
     'track-buffers': { func: term_helper, fragment: 'track-buffer', link_text: 'track buffers', },
     'last-decode-timestamp': { func: var_helper, fragment: '#last-decode-timestamp', link_text: 'last decode timestamp', },
     'highest-presentation-timestamp': { func: var_helper, fragment: '#highest-presentation-timestamp', link_text: 'highest presentation timestamp', },
+    'need-RAP-flag': { func: var_helper, fragment: '#need-RAP-flag', link_text: 'need random access point flag', },
 
     'FileAPI': { func: fileapi_helper, fragment: '', link_text: 'File API',  },
     'blob-uri': { func: fileapi_helper, fragment: 'url', link_text: 'Blob URI',  },
Binary file media-source/middle_overlap.png has changed
Binary file media-source/start_overlap.png has changed