<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26436</bug_id>
          
          <creation_ts>2014-07-25 18:13:19 +0000</creation_ts>
          <short_desc>[MSE] SourceBuffer Monitoring algorithm can cause stall after endOfStream()</short_desc>
          <delta_ts>2014-08-12 17:24:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>Media Source Extensions</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>CR</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jer Noble">jer.noble</reporter>
          <assigned_to name="Aaron Colwell">acolwell</assigned_to>
          <cc>acolwell</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-media</cc>
    
    <cc>strobe</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>109290</commentid>
    <comment_count>0</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2014-07-25 18:13:19 +0000</bug_when>
    <thetext>After MediaSource.endOfStream() is called, the duration of the media is extended to the highest reported buffered range of each SourceBuffer in MediaSource.sourceBuffers:

&quot;2.4.7 End of stream algorithm&quot;
&quot;3. If error is not set&quot;
&quot;3.1. Run the duration change algorithm with new duration set to the highest end time reported by the buffered attribute across all SourceBuffer objects in sourceBuffers.&quot;

Also, the buffered ranges returned by HTMLMediaElement.buffered are modified to include these &quot;virtual&quot; buffered ranges:

&quot;9. HTMLMediaElement Extensions&quot;
&quot;5. For each SourceBuffer object in activeSourceBuffers run the following steps:&quot;
&quot;5.2. If readyState is &quot;ended&quot;, then set the end time on the last range in source ranges to highest end time.&quot;

But the checks in &quot;SourceBuffer Monitoring&quot; use only the original, unmodified buffered ranges:

&quot;2.4.4 SourceBuffer Monitoring&quot;
&quot;If buffered for at least one object in activeSourceBuffers contains a TimeRange that ends at the current playback position and does not have a range covering the time immediately after the current position:&quot;
&quot;1. Set the HTMLMediaElement.readyState attribute to HAVE_CURRENT_DATA.&quot;

This causes playback to stall, and will typically occur at the end of a stream, after endOfStream() is called, when 2 or more SourceBuffers of fractionally different buffered lengths are active. It is exceedingly unlikely that streams of different types (audio, video) will have exactly the same duration, due to the relative sample durations of each media type.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110103</commentid>
    <comment_count>1</comment_count>
    <who name="Aaron Colwell">acolwell</who>
    <bug_when>2014-08-12 17:24:35 +0000</bug_when>
    <thetext>Change committed.
https://dvcs.w3.org/hg/html-media/rev/856c321c7a6b

I changed the steps in the SourceBuffer Monitoring to trigger transitions based on HTMLMediaElement.buffered instead of the individual SourceBuffer.buffered attributes. This should address the issue since HTMLMediaElement.buffered takes into account the extending of the ranges.

I also updated the HTMLMediaElement.readyState transition steps at the bottom of the &quot;coded frame processing&quot; algorithm to use HTMLMediaElement.buffered as well to make the behavior consistent with the SourceBuffer monitoring algorithm.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>