<?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>27599</bug_id>
          
          <creation_ts>2014-12-12 22:32:46 +0000</creation_ts>
          <short_desc>Allow SourceBuffer.trackDefaults to be nullable</short_desc>
          <delta_ts>2015-01-09 19:28:41 +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="Matt Wolenetz">wolenetz</reporter>
          <assigned_to name="Aaron Colwell">acolwell</assigned_to>
          <cc>acolwell</cc>
    
    <cc>b.gajda</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
    
    <cc>public-html-media</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>116239</commentid>
    <comment_count>0</comment_count>
    <who name="Matt Wolenetz">wolenetz</who>
    <bug_when>2014-12-12 22:32:46 +0000</bug_when>
    <thetext>In current spec, if an app wants to clear a SourceBuffer&apos;s non-empty trackDefaults, it must set the attribute to a TrackDefaultList that was constructed with an empty sequence&lt;TrackDefault&gt;. For example:
...
sb = mediaSource.activeSourceBuffers[0];
sb.trackDefaults = new TrackDefaultList( [] );
...

This bug is to request change to spec to make this operation more natural, by specifying:
0. the SourceBuffer.trackDefaults attribute is nullable
1. the SourceBuffer.trackDefaults attribute setter allows null
2. the initial value of SourceBuffer.trackDefaults is null
3. the default {language, kind, label} algorithms behave correctly if trackDefaults is null

These changes would be app-visible and #2 would possibly break existing apps. Alternatively, maybe #2 should be:
2. prior to any explicit set operation by app, the SourceBuffer.trackDefaults attribute getter should return an empty TrackDefaultList object that is the same object (===) each time for this SourceBuffer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116242</commentid>
    <comment_count>1</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-12 23:40:05 +0000</bug_when>
    <thetext>I think letting it default to null seems the most sane, a dummy object that doesn&apos;t hold any real info is a bit odd.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116270</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-13 20:34:32 +0000</bug_when>
    <thetext>About potential breakage, has SourceBuffer.trackDefaults been shipped in any browser?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116397</commentid>
    <comment_count>3</comment_count>
    <who name="Aaron Colwell">acolwell</who>
    <bug_when>2014-12-16 19:40:55 +0000</bug_when>
    <thetext>I&apos;m not sure I agree with this position. It seems annoying to me that application code would always have to check for null AND then check for length &gt; 0 before it could actually use the defaults. Having it always be non-null seems like a good way to avoid at least one of these checks.

I agree that requiring the [] is ugly. What if I made the constructor parameter optional and provided a default of []? That at least makes it a little less ugly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116399</commentid>
    <comment_count>4</comment_count>
    <who name="Matt Wolenetz">wolenetz</who>
    <bug_when>2014-12-16 21:14:54 +0000</bug_when>
    <thetext>(In reply to Aaron Colwell from comment #3)

&gt; I agree that requiring the [] is ugly. What if I made the constructor
&gt; parameter optional and provided a default of []? That at least makes it a
&gt; little less ugly.

This seems a good approach to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116404</commentid>
    <comment_count>5</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-12-16 23:17:23 +0000</bug_when>
    <thetext>That seems OK to me too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116969</commentid>
    <comment_count>6</comment_count>
    <who name="Aaron Colwell">acolwell</who>
    <bug_when>2015-01-09 19:28:41 +0000</bug_when>
    <thetext>Change committed...
https://github.com/w3c/media-source/commit/acd9345d853100eea4d5d19eca12347142c857b2</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>