<?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>283275</bug_id>
          
          <creation_ts>2024-11-17 19:54:36 -0800</creation_ts>
          <short_desc>Playback doesn&apos;t always resume after a seek</short_desc>
          <delta_ts>2024-11-22 06:54:35 -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>New Bugs</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="Jean-Yves Avenard [:jya]">jean-yves.avenard</reporter>
          <assigned_to name="Jean-Yves Avenard [:jya]">jean-yves.avenard</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2075730</commentid>
    <comment_count>0</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2024-11-17 19:54:36 -0800</bug_when>
    <thetext>When playing both a video through MediaSource or a WebM, when you quickly seek back and forth in the video which is currently playing. About 1 in 3 times playback will not resume.

STR:
- Start playing a MSE video or a WeBM video such as https://jyavenard.github.io/htmltests/mediatest/webm/Morocco_1080p30.webm
- Seek sometimes in the future.
- If video resumes, seek sometimes in the past

Repeat until after seeking playback stays pause.

It usually never takes more than 5 goes.

This happens because we seek to a MediaTime which is a backed by a double and we wait for the time synchroniser to complete its own seek. The synchroniser uses a rational number.

In the log sometimes I could see:
MediaPlayerPrivateWebM::operator()(E1CBD29A9CAC648C) seekedTime = {&quot;value&quot;:201.04438000000002}, synchronizerTime = {&quot;value&quot;:201.04438,&quot;numerator&quot;:2010443800,&quot;denominator&quot;:10000000,&quot;flags&quot;:1}synchronizer seeking = true

So even though we have synchronizerTime almost equal to seekedTime, the float rounding errors causes the test to determine if we&apos;ve completed the seek to fail
`m_isSynchronizerSeeking = synchronizerTime != seekedTime;` [1]

The same occurs playing this video over MSE [2]
[1] https://searchfox.org/wubkat/rev/d45649fa32a499702c30474e94bd6843c4c67849/Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm#437https://searchfox.org/wubkat/rev/d45649fa32a499702c30474e94bd6843c4c67849/Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm#437
[2] https://searchfox.org/wubkat/rev/d45649fa32a499702c30474e94bd6843c4c67849/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm#562</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075731</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-11-17 19:54:54 -0800</bug_when>
    <thetext>&lt;rdar://problem/140097993&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075733</commentid>
    <comment_count>2</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2024-11-17 20:04:13 -0800</bug_when>
    <thetext>Committed 286685@main (20984f6): https://commits.webkit.org/286685@main

Reviewed commits have been landed. Closing PR #36676 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075734</commentid>
    <comment_count>3</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2024-11-17 20:05:02 -0800</bug_when>
    <thetext>modified the wrong bug</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075736</commentid>
    <comment_count>4</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2024-11-17 20:17:58 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/36782</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2077008</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-11-22 06:54:34 -0800</bug_when>
    <thetext>Committed 286956@main (4a58bf5dbacc): &lt;https://commits.webkit.org/286956@main&gt;

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

    </bug>

</bugzilla>