<?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>177016</bug_id>
          
          <creation_ts>2017-09-15 11:21:02 -0700</creation_ts>
          <short_desc>MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData should enqueue data if still useful</short_desc>
          <delta_ts>2017-09-15 12:55:27 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="youenn fablet">youennf</reporter>
          <assigned_to name="youenn fablet">youennf</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>ggaren</cc>
    
    <cc>jer.noble</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1349407</commentid>
    <comment_count>0</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2017-09-15 11:21:02 -0700</bug_when>
    <thetext>If it is dead, no need to do it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349408</commentid>
    <comment_count>1</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2017-09-15 11:21:14 -0700</bug_when>
    <thetext>rdar://problem/33803695</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349409</commentid>
    <comment_count>2</comment_count>
      <attachid>320933</attachid>
    <who name="youenn fablet">youennf</who>
    <bug_when>2017-09-15 11:22:49 -0700</bug_when>
    <thetext>Created attachment 320933
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349414</commentid>
    <comment_count>3</comment_count>
      <attachid>320933</attachid>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2017-09-15 11:32:50 -0700</bug_when>
    <thetext>Comment on attachment 320933
Patch

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

&gt; Source/WebCore/ChangeLog:11
&gt; +        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData): exciting early in block to prevent enqueueing.

Nit: &quot;exiting&quot;.

&gt; Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:401
&gt; +    auto weakThis = createWeakPtr();
&gt;      [m_sampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^ {
&gt; +        if (!weakThis)
&gt; +            return;
&gt; +

Note that this won&apos;t necessarily be correct on iOS WK1, as the &quot;dispatch_get_main_queue()&quot; won&apos;t necessarily be the WebThread, in which case, you&apos;ll assert in the weakThis getter. This isn&apos;t a problem in the MSE code, since that&apos;s not enabled on iOS, but it may be a problem here, since media streams are.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349435</commentid>
    <comment_count>4</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2017-09-15 12:01:56 -0700</bug_when>
    <thetext>&gt; Note that this won&apos;t necessarily be correct on iOS WK1, as the
&gt; &quot;dispatch_get_main_queue()&quot; won&apos;t necessarily be the WebThread, in which
&gt; case, you&apos;ll assert in the weakThis getter. This isn&apos;t a problem in the MSE
&gt; code, since that&apos;s not enabled on iOS, but it may be a problem here, since
&gt; media streams are.

I am not familiar with WebThread.
I guess that if we are not in the WebThread, we could hop to it, through callOnMainThread probably?.

Or is there a way to dispatch it to the WebThread directly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349436</commentid>
    <comment_count>5</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2017-09-15 12:18:01 -0700</bug_when>
    <thetext>(In reply to youenn fablet from comment #4)
&gt; &gt; Note that this won&apos;t necessarily be correct on iOS WK1, as the
&gt; &gt; &quot;dispatch_get_main_queue()&quot; won&apos;t necessarily be the WebThread, in which
&gt; &gt; case, you&apos;ll assert in the weakThis getter. This isn&apos;t a problem in the MSE
&gt; &gt; code, since that&apos;s not enabled on iOS, but it may be a problem here, since
&gt; &gt; media streams are.
&gt; 
&gt; I am not familiar with WebThread.

The basic gist is that, to get smooth scrolling on iOS in WK1, all the WebCore &quot;main thread&quot; functions run off the process&apos;s main thread, an on a named thread called &quot;WebThread&quot;.

&gt; I guess that if we are not in the WebThread, we could hop to it, through
&gt; callOnMainThread probably?.

Yes. 

&gt; Or is there a way to dispatch it to the WebThread directly?

No, there&apos;s not (but that would be great!).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349441</commentid>
    <comment_count>6</comment_count>
      <attachid>320933</attachid>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2017-09-15 12:22:36 -0700</bug_when>
    <thetext>Comment on attachment 320933
Patch

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

&gt;&gt; Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:401
&gt;&gt; +
&gt; 
&gt; Note that this won&apos;t necessarily be correct on iOS WK1, as the &quot;dispatch_get_main_queue()&quot; won&apos;t necessarily be the WebThread, in which case, you&apos;ll assert in the weakThis getter. This isn&apos;t a problem in the MSE code, since that&apos;s not enabled on iOS, but it may be a problem here, since media streams are.

We don&apos;t support media streams in WK1 so this should be OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349442</commentid>
    <comment_count>7</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2017-09-15 12:23:56 -0700</bug_when>
    <thetext>(In reply to Eric Carlson from comment #6)
&gt; Comment on attachment 320933 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=320933&amp;action=review
&gt; 
&gt; &gt;&gt; Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:401
&gt; &gt;&gt; +
&gt; &gt; 
&gt; &gt; Note that this won&apos;t necessarily be correct on iOS WK1, as the &quot;dispatch_get_main_queue()&quot; won&apos;t necessarily be the WebThread, in which case, you&apos;ll assert in the weakThis getter. This isn&apos;t a problem in the MSE code, since that&apos;s not enabled on iOS, but it may be a problem here, since media streams are.
&gt; 
&gt; We don&apos;t support media streams in WK1 so this should be OK.

Oh, ok, never mind then. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349446</commentid>
    <comment_count>8</comment_count>
      <attachid>320933</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2017-09-15 12:27:54 -0700</bug_when>
    <thetext>Comment on attachment 320933
Patch

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

&gt; Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:400
&gt; +        if (!weakThis)
&gt; +            return;

What if the object gets destroyed after this check, but before the rest of the code in the block runs?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349451</commentid>
    <comment_count>9</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2017-09-15 12:32:27 -0700</bug_when>
    <thetext>I think there is a plan to try removing the WebThread.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349452</commentid>
    <comment_count>10</comment_count>
      <attachid>320933</attachid>
    <who name="youenn fablet">youennf</who>
    <bug_when>2017-09-15 12:36:07 -0700</bug_when>
    <thetext>Comment on attachment 320933
Patch

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

&gt;&gt; Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:400
&gt;&gt; +            return;
&gt; 
&gt; What if the object gets destroyed after this check, but before the rest of the code in the block runs?

As I read it, the object destruction and this code block should both happen on the same thread.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349458</commentid>
    <comment_count>11</comment_count>
      <attachid>320933</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2017-09-15 12:46:19 -0700</bug_when>
    <thetext>Comment on attachment 320933
Patch

Have we converged to an r+ then?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349460</commentid>
    <comment_count>12</comment_count>
    <who name="Jer Noble">jer.noble</who>
    <bug_when>2017-09-15 12:48:16 -0700</bug_when>
    <thetext>(In reply to Geoffrey Garen from comment #11)
&gt; Comment on attachment 320933 [details]
&gt; Patch
&gt; 
&gt; Have we converged to an r+ then?

Yep.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349472</commentid>
    <comment_count>13</comment_count>
      <attachid>320933</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-09-15 12:55:26 -0700</bug_when>
    <thetext>Comment on attachment 320933
Patch

Clearing flags on attachment: 320933

Committed r222105: &lt;http://trac.webkit.org/changeset/222105&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1349473</commentid>
    <comment_count>14</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2017-09-15 12:55:27 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>320933</attachid>
            <date>2017-09-15 11:22:49 -0700</date>
            <delta_ts>2017-09-15 12:55:26 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-177016-20170915112249.patch</filename>
            <type>text/plain</type>
            <size>1981</size>
            <attacher name="youenn fablet">youennf</att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