<?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>259699</bug_id>
          
          <creation_ts>2023-08-01 12:46:07 -0700</creation_ts>
          <short_desc>REGRESSION(262173@main): [ macOS WK2 ] media/media-source/media-source-duplicate-seeked.html is a flaky failure</short_desc>
          <delta_ts>2023-08-17 18:35:58 -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>WebKit Nightly Build</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=254074</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=225367</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=260185</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>eric.carlson</cc>
    
    <cc>graouts</cc>
    
    <cc>jean-yves.avenard</cc>
    
    <cc>webkit-bot-watchers-bugzilla</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1969102</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Schwartz">ben_schwartz</who>
    <bug_when>2023-08-01 12:46:07 -0700</bug_when>
    <thetext>media/media-source/media-source-duplicate-seeked.html

This test is a flaky failure on macOS WK2 (including gpuprocess).

HISTORY:

https://results.webkit.org/?suite=layout-tests&amp;test=media%2Fmedia-source%2Fmedia-source-duplicate-seeked.html&amp;platform=mac&amp;flavor=wk2&amp;recent=false

TEXT DIFF:

 RUN(video.currentTime = 1)
 EVENT(seeked)
 RUN(video.play())
-EVENT(ended)
+EVENT(seeked) TEST(false) FAIL
 END OF TEST

DIFF URL:

https://build.webkit.org/results/Apple-Ventura-Release-AppleSilicon-WK2-Tests/266464%40main%20(4230)/media/media-source/media-source-duplicate-seeked-pretty-diff.html

REPRODUCIBILITY:

I was able to reproduce this bug on macOS Ventura at ToT running the test as follows:

run-webkit-tests --iterations 100 --child-processes=5 --verbose media/media-source/media-source-duplicate-seeked.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>1969103</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-08-01 12:46:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/113221970&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1969114</commentid>
    <comment_count>2</comment_count>
    <who name="Ben Schwartz">ben_schwartz</who>
    <bug_when>2023-08-01 13:29:58 -0700</bug_when>
    <thetext>I have marked this test as a flaky failure while this issue is investigated. (Link: https://github.com/WebKit/WebKit/pull/16288)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1969121</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-08-01 13:42:56 -0700</bug_when>
    <thetext>Test gardening commit 266489@main (3cd791a12459): &lt;https://commits.webkit.org/266489@main&gt;

Reviewed commits have been landed. Closing PR #16288 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971221</commentid>
    <comment_count>4</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-08-14 21:01:32 -0700</bug_when>
    <thetext>The test is non-deterministic/invalid.

It adds 1s of video element (using the MockSourceBuffer) and set the duration to 1s.
It then seeks `currentTime = 1` which is the end of the video and then calls play() again once the `seeked` event has fired.

However, per spec, if the playback has reached the end of the video and you call `play()`

https://html.spec.whatwg.org/multipage/media.html#internal-play-steps
&quot;If the playback has ended and the direction of playback is forwards, seek to the earliest possible position of the media resource.&quot;

so we seek again.

The flow of the test is as follow:
1- Load 1s of data
2- set duration to 1s
3- call endOfStream
3- seek to 1s
4- seek completes -&gt; `seeked` event is fired.
5- `ended` event is fired
5- call play(), we are at the end of the element, we seek to the start -&gt; `seeked` event is fired,
6- playback continue and now reaches the end -&gt; `ended` event is fired.

So we have the `ended` event fired twice, but the test expect `ended` to be fired before `seeked` which is only true if the listener of the first `ended` event hasn&apos;t run.

Not seeking to the end of the video at the start of the test, but slightly before would keep the aim of the test, but not caused `ended` event to be fired twice as we will only reach the end if the media is playing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971228</commentid>
    <comment_count>5</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-08-14 21:41:43 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/16696</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1971964</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-08-17 18:35:36 -0700</bug_when>
    <thetext>Committed 267024@main (95c4d7e41e12): &lt;https://commits.webkit.org/267024@main&gt;

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

    </bug>

</bugzilla>