<?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>260185</bug_id>
          
          <creation_ts>2023-08-14 17:26:02 -0700</creation_ts>
          <short_desc>REGRESSION(262173@main): media/media-source/media-source-fastseek.html is a flaky text failure</short_desc>
          <delta_ts>2023-08-29 11:11:41 -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>Media</component>
          <version>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=259699</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=250844</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=260607</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=260742</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=260833</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=260867</see_also>
          <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="Ben Schwartz">ben_schwartz</reporter>
          <assigned_to name="Jean-Yves Avenard [:jya]">jean-yves.avenard</assigned_to>
          <cc>jean-yves.avenard</cc>
    
    <cc>webkit-bot-watchers-bugzilla</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1971184</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Schwartz">ben_schwartz</who>
    <bug_when>2023-08-14 17:26:02 -0700</bug_when>
    <thetext>media/media-source/media-source-fastseek.html

This test is a flaky text failure on wk2 on macOS Monterey and above (EXCEPT on debug builds on x86_64 architecture).

HISTORY:

https://results.webkit.org/?suite=layout-tests&amp;test=media%2Fmedia-source%2Fmedia-source-fastseek.html&amp;flavor=wk2&amp;version_name=Monterey&amp;version_name=Ventura

TEXT DIFF:

 EXPECTED (video.currentTime.toFixed(1) == &apos;3&apos;) OK
 RUN(video.fastSeek(2))
 EVENT(seeked)
-EXPECTED (video.currentTime.toFixed(1) == &apos;0&apos;) OK
+EXPECTED (video.currentTime.toFixed(1) == &apos;0&apos;), OBSERVED &apos;3.0&apos; FAIL
 END OF TEST

DIFF URL:

https://build.webkit.org/results/Apple-Ventura-Release-AppleSilicon-WK2-Tests/266873@main%20(4437)/media/media-source/media-source-fastseek-diff.txt

REPRODUCTION:

I was able to reproduce this bug on macOS Monterey (x86_64) running the test as follows:

run-webkit-tests --clobber-old-results --iterations 1000 --exit-after-n-failures 5 media/media-source/media-source-fastseek.html

REGRESSION:

I was able to bisect a regression point using the flakiness dashboard. This test reproduced at 262173@main, but it did not reproduce at 262172@main. Changes at 262173@main appear to be directly related to this error, and is likely what caused the failure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971185</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-08-14 17:26:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/113881009&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971190</commentid>
    <comment_count>2</comment_count>
    <who name="Ben Schwartz">ben_schwartz</who>
    <bug_when>2023-08-14 17:55:02 -0700</bug_when>
    <thetext>I have marked this test as a flaky failure while the issue is being investigated. (PR link: https://github.com/WebKit/WebKit/pull/16693)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971191</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-08-14 17:56:48 -0700</bug_when>
    <thetext>Test gardening commit 266889@main (9544bcf5ae90): &lt;https://commits.webkit.org/266889@main&gt;

Reviewed commits have been landed. Closing PR #16693 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971753</commentid>
    <comment_count>4</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-08-17 00:09:17 -0700</bug_when>
    <thetext>I can see what the problem is: we assume that we have completed the seek when we have a signal that the time changed and that the player is not seeking.

However, as soon as the RemoteMediaPlayer receives a timechange call, it assumes seeking has completed. That is not always the case: like if the GPU Process sent timechange just before we started seeking.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971789</commentid>
    <comment_count>5</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-08-17 03:46:56 -0700</bug_when>
    <thetext>fastSeek with MediaSource is broken as it is.

When performing an accurate seek, the flow is to call MediaSourcePrivate::waitForSeekCompleted() , seek and then MediaSourcePrivate::seekCompleted().

between the two `waitForSeekCompleted` and `seekCompleted` `MediaPlayerPrivate::seeking` will return false.

However, when doing a fast seek, we never call `MediaSourcePrivate::waitForSeekCompleted()` so `MediaPlayerPrivate::seeking` will return a stale value, which is typically the state of the previous seek and so typically `false`

In this particular test, when we perform a `fastSeek` , if the GPU Process sent an earlier `timeChanged` as `MediaPlayerPrivate::seeking` will return `false` and so we fire `seeked` event even before the GPU Process has completed the seek operation and had time to update the currentTime to the actual value.

I also note that in `void HTMLMediaElement::mediaPlayerTimeChanged()` we immediately call `updateActiveTextTrackCues(currentMediaTime());` but at this stage, currentMediaTime() returns the value of currentTime prior the seek operation. And as such it will set the TrackCues to the wrong time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972342</commentid>
    <comment_count>6</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-08-21 03:44:04 -0700</bug_when>
    <thetext>It&apos;s actually a very similar failure to bug 250844.

But while bug 250844 fixed it in just AVFObjC implementation, we can adopt a more global solution by making the entire seek operation an asynchronous operation with completion handlers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972964</commentid>
    <comment_count>7</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-08-23 07:04:26 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/16974</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1973522</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-08-25 07:17:47 -0700</bug_when>
    <thetext>Committed 267279@main (ee5de7a0c1f2): &lt;https://commits.webkit.org/267279@main&gt;

Reviewed commits have been landed. Closing PR #16974 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>