<?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>257035</bug_id>
          
          <creation_ts>2023-05-19 08:50:46 -0700</creation_ts>
          <short_desc>[MSE][GStreamer] Actually do flushes, unify m_hasAllTracks</short_desc>
          <delta_ts>2023-05-25 03:48:33 -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>WebKitGTK</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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alicia Boya García">aboya</reporter>
          <assigned_to name="Alicia Boya García">aboya</assigned_to>
          <cc>bugs-noreply</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1956507</commentid>
    <comment_count>0</comment_count>
    <who name="Alicia Boya García">aboya</who>
    <bug_when>2023-05-19 08:50:46 -0700</bug_when>
    <thetext>Before this patch, there were two classes having a m_hasAllTracks field:
MediaSourcePrivateGStreamer and MediaPlayerPrivateGStreamerMSE.

This redundancy lead to non-synchronization, and in consequence this was
making flushes not occur on MSE, as
SourceBufferPrivateGStreamer::flush() checked for the one in
MediaPlayerPrivateGStreamerMSE which no code ever set to true.

A visible consequence of this was video was being repeated on quality
changes, due to the lack of flush of old frames.

This patch fixes the issue by keeping the `hasAllTracks` state in one
single place, in MediaSourcePrivateGStreamer.

Note:

The triggering of MSE flushes exposed several bugs on the handling of
flushes in other parts of the code. It&apos;s important these are addressed
to avoid regressions in behavior when incorporating this patch:

(1) https://github.com/WebKit/WebKit/pull/3802
    [GStreamer] MediaPlayerPrivateGStreamer: Abort stale tasks on flushes

    Without this patch, MSE flushes can deadlock.

(2) https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2413
    appsink: Fix race condition on caps handling

    appsink used to have a race condition on the handling of caps after
    a flush that can cause crashes. A fix is present in GStreamer 1.20.3+.

    A workaround in the WebKit side is possible and desirable to avoid
    headaches in Linux distros, and has been uploaded as:

    https://github.com/WebKit/WebKit/pull/3965
    [GStreamer] Introduce workaround for race condition in appsink

(3) https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3471 
    basesink: Support position queries after non-resetting flushes

    basesink doesn&apos;t answer position queries between a FLUSH_STOP with
    reset_time=FALSE and a SEGMENT event until GStreamer 1.24.0, which
    incorporates that patch.

    For backwards-compatibility -- and present-compatibility for that matter
    since GStreamer 1.24.0 has not been released yet, a workaround has been
    Proposed for WebKit:

    https://github.com/WebKit/WebKit/pull/14082
    [MSE][GStreamer] Workaround basesink&apos;s lack of support for position queries between a non-resetting flush and a pre-roll</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1956508</commentid>
    <comment_count>1</comment_count>
    <who name="Alicia Boya García">aboya</who>
    <bug_when>2023-05-19 08:53:18 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/3966</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1957862</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-05-25 03:48:30 -0700</bug_when>
    <thetext>Committed 264510@main (3e5ad5ea060b): &lt;https://commits.webkit.org/264510@main&gt;

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

    </bug>

</bugzilla>