<?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>313098</bug_id>
          
          <creation_ts>2026-04-22 21:39:22 -0700</creation_ts>
          <short_desc>media/media-source/media-managedmse-resume-after-stall.html is an intermittent failure</short_desc>
          <delta_ts>2026-04-24 17:53:37 -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>
          
          
          <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>2203522</commentid>
    <comment_count>0</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-04-22 21:39:22 -0700</bug_when>
    <thetext>Times out from time to time.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2203523</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-04-22 21:39:28 -0700</bug_when>
    <thetext>&lt;rdar://problem/175395328&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2203527</commentid>
    <comment_count>2</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-04-22 22:17:16 -0700</bug_when>
    <thetext>can be reproduced locally with `run-webkit-tests --release --no-retry --repeat=50 --exit-after-n-crashes-or-timeouts=1 media/media-source/media-managedmse-resume-after-stall.html` 

[4/50] media/media-source/media-managedmse-resume-after-stall.html failed unexpectedly (test timed out, text diff)
Exiting early after 0 crashes and 1 timeouts. 4 tests run.


2 tests ran as expected, 2 didn&apos;t (46 didn&apos;t run):


Unexpected flakiness: timeouts (1)
  media/media-source/media-managedmse-resume-after-stall.html [ Pass Timeout ]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2203572</commentid>
    <comment_count>3</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-04-23 01:06:38 -0700</bug_when>
    <thetext>This is a regression from the MediaContainment feature.

What&apos;s happening is that when we re-enqueue samples on the SourceBuffer, we override samples. This cause the renderer&apos;s tracks to be flushed.

When new samples have been re-appended and the buffered range no longer have a gap, we call AudioVideoRenderer::play() on the main thread.
Samples are enqueued by the SourceBufferPrivate on the MediaSourcePrivate&apos;s queue. 

If the play() command runs first, setting the rate on the synchroniser before any audio samples being re-enqueued: setRate appears to fail and is a de-facto no-op.

Once audio is appended, playback never resume.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2203921</commentid>
    <comment_count>4</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-04-23 15:57:48 -0700</bug_when>
    <thetext>Analysis above ended up not being the cause.

In this test the interaction with the renderer should be as followed:
play() -&gt; stall() -&gt; flush() -&gt; enqueueSamples() -&gt; play()

from time to time it becomes:
play() -&gt; stall() -&gt; play() -&gt; flush() -&gt; enqueueSamples() 

When this happens, and play() is called while the synchroniser and audio/video renderer have been suspended me make it resume, this makes the synchroniser time to stop progressing, the flush / enqueue doesn&apos;t resume things.

This is a race between the MediaSource calling play() on the main thread and the SourceBufferPrivate performing the flush/re-enqueue on its queue. The order of operations is no longer deterministic when it used to be (everything was on the main thread before)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2203932</commentid>
    <comment_count>5</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2026-04-23 16:27:20 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/63480</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2204340</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-04-24 17:53:35 -0700</bug_when>
    <thetext>Committed 311992@main (09ea5e2ced87): &lt;https://commits.webkit.org/311992@main&gt;

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

    </bug>

</bugzilla>