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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>165132</bug_id>
          
          <creation_ts>2016-11-28 21:44:32 -0800</creation_ts>
          <short_desc>HTMLMediaElement::setVolume should updateIsPlayingMedia</short_desc>
          <delta_ts>2016-11-29 11:47:31 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Media</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Gavin Barraclough">barraclough</reporter>
          <assigned_to name="Gavin Barraclough">barraclough</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1254205</commentid>
    <comment_count>0</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2016-11-28 21:44:32 -0800</bug_when>
    <thetext>HTMLMediaElement::mediaState takes the volume into account when determining whether media is playing (audio is not considered to be playing if volume is 0). As such, and change to the volume may require mediaState to be recomputed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1254206</commentid>
    <comment_count>1</comment_count>
      <attachid>295581</attachid>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2016-11-28 21:47:33 -0800</bug_when>
    <thetext>Created attachment 295581
Fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1254285</commentid>
    <comment_count>2</comment_count>
      <attachid>295581</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2016-11-29 08:58:54 -0800</bug_when>
    <thetext>Comment on attachment 295581
Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=295581&amp;action=review

Might be OK, but what about in loadResource, mediaPlayerVolumeChanged, mediaVolumeDidChange, pageMutedStateDidChange, and setShouldDuck? Maybe this should go into the updateVolume function instead?

I’ll say r=me but please consider that.

&gt; Source/WebCore/ChangeLog:9
&gt; +        is playing (audio is not considered to be playing if volume is 0). As such, and change to

typo &quot;and&quot; for &quot;any&quot;

&gt; Source/WebCore/html/HTMLMediaElement.cpp:3247
&gt;      m_volumeInitialized = true;

Follow-up idea: We should make m_volume be std::optional&lt;double&gt; instead of using a double plus a boolean.

&gt; Source/WebCore/html/HTMLMediaElement.cpp:3255
&gt; +#if ENABLE(MEDIA_SESSION)
&gt; +    document().updateIsPlayingMedia(m_elementID);
&gt; +#else
&gt; +    document().updateIsPlayingMedia();
&gt; +#endif

Follow-up idea: We should create a helper member function to do this so we don’t have to repeat this five-line sequence in five different places in the class. Can be inline if we like.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1254336</commentid>
    <comment_count>3</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2016-11-29 10:58:36 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Comment on attachment 295581 [details]
&gt; Fix
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=295581&amp;action=review
&gt; 
&gt; Might be OK, but what about in loadResource, mediaPlayerVolumeChanged,
&gt; mediaVolumeDidChange, pageMutedStateDidChange, and setShouldDuck? Maybe this
&gt; should go into the updateVolume function instead?
&gt; 
&gt; I’ll say r=me but please consider that.

Have made this change.

&gt; &gt; Source/WebCore/ChangeLog:9
&gt; &gt; +        is playing (audio is not considered to be playing if volume is 0). As such, and change to
&gt; 
&gt; typo &quot;and&quot; for &quot;any&quot;
&gt; 
&gt; &gt; Source/WebCore/html/HTMLMediaElement.cpp:3247
&gt; &gt;      m_volumeInitialized = true;
&gt; 
&gt; Follow-up idea: We should make m_volume be std::optional&lt;double&gt; instead of
&gt; using a double plus a boolean.

Will look at this as a followup.

&gt; &gt; Source/WebCore/html/HTMLMediaElement.cpp:3255
&gt; &gt; +#if ENABLE(MEDIA_SESSION)
&gt; &gt; +    document().updateIsPlayingMedia(m_elementID);
&gt; &gt; +#else
&gt; &gt; +    document().updateIsPlayingMedia();
&gt; &gt; +#endif
&gt; 
&gt; Follow-up idea: We should create a helper member function to do this so we
&gt; don’t have to repeat this five-line sequence in five different places in the
&gt; class. Can be inline if we like.

If we want to clean up here, with a plan to keep the MEDIA_SESSION code, then I think we could just remove the ifdef &amp; keep the version that passes the argument. (In the callee I think it&apos;s unused anyway if MEDIA_SESSION is compiled out.)

Discussed with Jer &amp; he recommends holding off on cleanup here for now - thinks MEDIA_SESSION code paths probably need to be removed, and can more cleanly be completely removed as is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1254372</commentid>
    <comment_count>4</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2016-11-29 11:47:31 -0800</bug_when>
    <thetext>Committed revision 209084.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>295581</attachid>
            <date>2016-11-28 21:47:33 -0800</date>
            <delta_ts>2016-11-29 08:58:54 -0800</delta_ts>
            <desc>Fix</desc>
            <filename>165132.1.patch</filename>
            <type>text/plain</type>
            <size>1551</size>
            <attacher name="Gavin Barraclough">barraclough</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDIwOTA1OSkKKysrI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LWVuY3J5cHQtZGVj
cnlwdC5odG1sCkluZGV4OiBTb3VyY2UvV2ViQ29yZS9odG1sL0hUTUxNZWRpYUVsZW1lbnQuY3Bw
Cj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT0KLS0tIFNvdXJjZS9XZWJDb3JlL2h0bWwvSFRNTE1lZGlhRWxlbWVudC5jcHAJ
KHJldmlzaW9uIDIwOTAzNCkKKysrIFNvdXJjZS9XZWJDb3JlL2h0bWwvSFRNTE1lZGlhRWxlbWVu
dC5jcHAJKHdvcmtpbmcgY29weSkKQEAgLTMyNDcsNiArMzI0NywxMiBAQCBFeGNlcHRpb25Pcjx2
b2lkPiBIVE1MTWVkaWFFbGVtZW50OjpzZXRWCiAgICAgbV92b2x1bWVJbml0aWFsaXplZCA9IHRy
dWU7CiAgICAgdXBkYXRlVm9sdW1lKCk7CiAgICAgc2NoZWR1bGVFdmVudChldmVudE5hbWVzKCku
dm9sdW1lY2hhbmdlRXZlbnQpOworCisjaWYgRU5BQkxFKE1FRElBX1NFU1NJT04pCisgICAgZG9j
dW1lbnQoKS51cGRhdGVJc1BsYXlpbmdNZWRpYShtX2VsZW1lbnRJRCk7CisjZWxzZQorICAgIGRv
Y3VtZW50KCkudXBkYXRlSXNQbGF5aW5nTWVkaWEoKTsKKyNlbmRpZgogI2VuZGlmCiAgICAgcmV0
dXJuIHsgfTsKIH0K
</data>
<flag name="review"
          id="318133"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>