<?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>174241</bug_id>
          
          <creation_ts>2017-07-06 22:31:54 -0700</creation_ts>
          <short_desc>[GTK] Layout test media/video-inactive-playback.html is timing out</short_desc>
          <delta_ts>2018-01-15 07:32:56 -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>WebKitGTK</component>
          <version>Other</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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>
          
          <blocked>162582</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cturner</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>jer.noble</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>pnormand</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1326393</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-07-06 22:31:54 -0700</bug_when>
    <thetext>Layout test media/video-inactive-playback.html is timing out on the GTK port since it was added in r218417 &quot;[iOS] Do not pause playing video when application resigns active state.&quot; Updating expectations accordingly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335916</commentid>
    <comment_count>1</comment_count>
    <who name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</who>
    <bug_when>2017-08-07 03:59:59 -0700</bug_when>
    <thetext>I looked into this and the problem is that the test sets restrictions on the &quot;videoaudio&quot; session:

        run(&apos;internals.setMediaSessionRestrictions(&quot;videoaudio&quot;, &quot;&quot;)&apos;);
        run(&apos;internals.setMediaSessionRestrictions(&quot;videoaudio&quot;, &quot;inactiveprocessplaybackrestricted&quot;)&apos;);

while forEachSession only finds a &quot;video&quot; session. This means nothing special happens and neither the expected &quot;pause&quot; or the expected &quot;playing&quot; event are fired.

(However, a &quot;playing&quot; event is fired as the result of the video finishing naturally.)

It&apos;s not clear to me why this test works at all on other platforms.

Jer, thoughts?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335963</commentid>
    <comment_count>2</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2017-08-07 08:57:46 -0700</bug_when>
    <thetext>(In reply to Ms2ger from comment #1)
&gt; I looked into this and the problem is that the test sets restrictions on the
&gt; &quot;videoaudio&quot; session:
&gt; 
&gt;         run(&apos;internals.setMediaSessionRestrictions(&quot;videoaudio&quot;, &quot;&quot;)&apos;);
&gt;         run(&apos;internals.setMediaSessionRestrictions(&quot;videoaudio&quot;,
&gt; &quot;inactiveprocessplaybackrestricted&quot;)&apos;);
&gt; 
&gt; while forEachSession only finds a &quot;video&quot; session. This means nothing
&gt; special happens and neither the expected &quot;pause&quot; or the expected &quot;playing&quot;
&gt; event are fired.
&gt; 
&gt; (However, a &quot;playing&quot; event is fired as the result of the video finishing
&gt; naturally.)
&gt; 
&gt; It&apos;s not clear to me why this test works at all on other platforms.
&gt; 
&gt; Jer, thoughts?

The file LayoutTests/media/content/test.{mp4,ogv} should have both an audio and a video track, so the resulting session should be of MediaType &quot;VideoAudio&quot;, and not just &quot;Video&quot;.  It sounds like that&apos;s the source of your problem.

If you look at HTMLMediaElement::mediaType(), it will return VideoAudio if the readyState &gt;= HAVE_METADATA, the MediaPlayerPrivate return true for hasVideo() &amp; hasAudio(), and the element is not muted.  So either this test is being run before the &quot;loadedmetadata&quot; event is fired, or the GTK media player doesn&apos;t think the file has audio.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337340</commentid>
    <comment_count>3</comment_count>
    <who name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</who>
    <bug_when>2017-08-10 00:47:43 -0700</bug_when>
    <thetext>The problem appears to be that Page::m_mutedState is AudioIsMuted. I have not yet been able to figure out how it got that way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337414</commentid>
    <comment_count>4</comment_count>
    <who name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</who>
    <bug_when>2017-08-10 07:59:11 -0700</bug_when>
    <thetext>Looks like this and a bunch of other tests were broken by bug 162582.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337445</commentid>
    <comment_count>5</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2017-08-10 09:07:56 -0700</bug_when>
    <thetext>(In reply to Ms2ger from comment #4)
&gt; Looks like this and a bunch of other tests were broken by bug 162582.

Sounds like the GTK media player is reporting !hasAudio() when the page state is muted. That seems wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337479</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-08-10 10:25:40 -0700</bug_when>
    <thetext>(In reply to Jer Noble from comment #5)
&gt; (In reply to Ms2ger from comment #4)
&gt; &gt; Looks like this and a bunch of other tests were broken by bug 162582.
&gt; 
&gt; Sounds like the GTK media player is reporting !hasAudio() when the page
&gt; state is muted. That seems wrong.

Charlie, this would be a good one for you or Calvaris to look into.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337842</commentid>
    <comment_count>7</comment_count>
    <who name="Ms2ger (he/him; ⌚ UTC+1/+2)">Ms2ger</who>
    <bug_when>2017-08-10 23:44:51 -0700</bug_when>
    <thetext>The code isn&apos;t specific to GTK, though:

bool HTMLMediaElement::effectiveMuted() const
{
    return muted() || (document().page() &amp;&amp; document().page()-&gt;isAudioMuted());
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1388176</commentid>
    <comment_count>8</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2018-01-11 02:22:36 -0800</bug_when>
    <thetext>Ms2ger was right in comment 3, the page is muted by default by WKTR so the test should un-mute it in its go function with internals.setPageMuted(&quot;&quot;);

I&apos;m also a bit confused as to why this passes on other platforms, I&apos;ll try to dig this down further...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1388187</commentid>
    <comment_count>9</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2018-01-11 03:20:16 -0800</bug_when>
    <thetext>The current explanation I have is that in the player the volume element gets muted based on MediaPlayer::muted() value, which is true because the page is muted. I think this behavior is different on other platforms, so that&apos;s why they don&apos;t need to explicitely un-mute the page.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1388188</commentid>
    <comment_count>10</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2018-01-11 03:32:19 -0800</bug_when>
    <thetext>Another potential issue is that hasAudio() might return false before the gst pipeline is fully built and the audio track was discovered. This effectively short-cuts the page state too...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1389270</commentid>
    <comment_count>11</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2018-01-15 03:15:55 -0800</bug_when>
    <thetext>On mac the test passes because the AVF player doesn&apos;t support muting, so the volume is set to 0 from the player POV in HTMLMediaElement::updatePlayState() but the HTMLMediaElement m_muted attribute remains false. This is an inconsistency :(

Moreover the AVF player ::setMuted() method is implemented for both mac and iOS but supportsMuting() returns true only for iOS, yet another inconsistency.

If I replace the m_player-&gt;setMuted() call with a setMuted() call in HTMLMediaElement::updatePlayState() I get the test timeout on mac, same as in GTK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1389296</commentid>
    <comment_count>12</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2018-01-15 07:32:56 -0800</bug_when>
    <thetext>Fixed in https://trac.webkit.org/r226948

But maybe the Apple folks should consider checking the little inconsistencies I found in the AVF player?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>