<?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>202204</bug_id>
          
          <creation_ts>2019-09-25 07:44:54 -0700</creation_ts>
          <short_desc>REGRESSION(r246399): [GStreamer] Problems playing AAC streams</short_desc>
          <delta_ts>2019-11-20 07:33:14 -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>WebKitGTK</component>
          <version>Other</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>
          
          <blocked>198377</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Alberto Garcia">berto</reporter>
          <assigned_to name="Philippe Normand">pnormand</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>calvaris</cc>
    
    <cc>cgarcia</cc>
    
    <cc>clopez</cc>
    
    <cc>cturner</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>gustavo</cc>
    
    <cc>menard</cc>
    
    <cc>pnormand</cc>
    
    <cc>vjaquez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1574053</commentid>
    <comment_count>0</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2019-09-25 07:44:54 -0700</bug_when>
    <thetext>This stream fails to play, or plays only for a few seconds:

http://tmp.xaq.nl/test-aac.html

These two work fine, but will occasionally fail if played *after* the AAC stream:

http://tmp.xaq.nl/test-mp3.html
http://tmp.xaq.nl/test-hls.html

Reportedly WebKitGTK 2.24.0 was the last one that didn&apos;t have problems with this.

I can reproduce the problem with 2.24.4, and it seems to fail with 2.26.1 as well.

Originally reported here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=941137</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575300</commentid>
    <comment_count>1</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2019-09-30 13:08:16 -0700</bug_when>
    <thetext>I can&apos;t reproduce with 2.24.2, but I can with 2.24.3.
I can also reproduce with trunk.

So I guess the problem is caused by one of the patches back-ported to 2.24.3.
Looking at the list https://trac.webkit.org/wiki/WebKitGTK/2.24.x#Proposedmergesfor2.24.3 I see several GStreamer related patches there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575302</commentid>
    <comment_count>2</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2019-09-30 13:15:21 -0700</bug_when>
    <thetext>It seems it is caused by r246399

If I revert it on my local checkout (I&apos;m on trunk@250519) I can&apos;t longer reproduce the issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575459</commentid>
    <comment_count>3</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-10-01 00:53:50 -0700</bug_when>
    <thetext>I&apos;ll try to check it this week, thanks for the bisect Carlos!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575499</commentid>
    <comment_count>4</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-10-01 05:06:43 -0700</bug_when>
    <thetext>Strange that commit introduced the regression for sure?

Here what I observe is that the internal queue gets drained just before the next data chunk arrives and that triggers EOS. However it shouldn&apos;t be triggered because this is a &quot;live&quot; non-seekable stream. I have a simple fix but I&apos;ll try to write a layout test as well, which will delay the upstreaming of the fix.

So here&apos;s the fix, in case downstream users are in urgent need of it:

diff --git a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
index 9810c257b37..965b6e276d0 100644
--- a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
@@ -451,11 +451,11 @@ static GstFlowReturn webKitWebSrcCreate(GstPushSrc* pushSrc, GstBuffer** buffer)
             GST_BUFFER_OFFSET(*buffer) = baseSrc-&gt;segment.position;
             GST_BUFFER_OFFSET_END(*buffer) = GST_BUFFER_OFFSET(*buffer) + size;
             GST_TRACE_OBJECT(src, &quot;Buffer bounds set to %&quot; G_GUINT64_FORMAT &quot;-%&quot; G_GUINT64_FORMAT, GST_BUFFER_OFFSET(*buffer), GST_BUFFER_OFFSET_END(*buffer));
-            GST_TRACE_OBJECT(src, &quot;doesHaveEOS: %s, wasSeeking: %s, seeking: %s, size: %u&quot;, boolForPrinting(priv-&gt;doesHaveEOS), boolForPrinting(priv-&gt;wasSeeking), boolForPrinting(priv-&gt;isSeeking), size);
+            GST_TRACE_OBJECT(src, &quot;doesHaveEOS: %s, wasSeeking: %s, seeking: %s, buffer size: %u, size: %&quot; G_GUINT64_FORMAT, boolForPrinting(priv-&gt;doesHaveEOS), boolForPrinting(priv-&gt;wasSeeking), boolForPrinting(priv-&gt;isSeeking), size, priv-&gt;size);
             if (priv-&gt;haveSize &amp;&amp; GST_BUFFER_OFFSET_END(*buffer) &gt;= priv-&gt;size) {
                 if (priv-&gt;wasSeeking)
                     priv-&gt;wasSeeking = false;
-                else
+                else if (priv-&gt;isSeekable)
                     priv-&gt;doesHaveEOS = true;
             } else if (priv-&gt;wasSeeking)
                 priv-&gt;wasSeeking = false;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1575506</commentid>
    <comment_count>5</comment_count>
    <who name="Carlos Alberto Lopez Perez">clopez</who>
    <bug_when>2019-10-01 05:30:33 -0700</bug_when>
    <thetext>(In reply to Philippe Normand from comment #4)
&gt; Strange that commit introduced the regression for sure?
&gt; 

I&apos;m not sure if it was the one that introduced the regression, or the one that seems to work-around the issue if reverted. I didn&apos;t a full bisect.
I just tested to revert it on my local branch, and observed that after reverting it the issue seems fixed.

&gt; Here what I observe is that the internal queue gets drained just before the
&gt; next data chunk arrives and that triggers EOS. However it shouldn&apos;t be
&gt; triggered because this is a &quot;live&quot; non-seekable stream. I have a simple fix
&gt; but I&apos;ll try to write a layout test as well, which will delay the
&gt; upstreaming of the fix.
&gt; 
&gt; So here&apos;s the fix, in case downstream users are in urgent need of it:
&gt; 
&gt; diff --git
&gt; a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
&gt; b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
&gt; index 9810c257b37..965b6e276d0 100644
&gt; --- a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
&gt; +++ b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
&gt; @@ -451,11 +451,11 @@ static GstFlowReturn webKitWebSrcCreate(GstPushSrc*
&gt; pushSrc, GstBuffer** buffer)
&gt;              GST_BUFFER_OFFSET(*buffer) = baseSrc-&gt;segment.position;
&gt;              GST_BUFFER_OFFSET_END(*buffer) = GST_BUFFER_OFFSET(*buffer) +
&gt; size;
&gt;              GST_TRACE_OBJECT(src, &quot;Buffer bounds set to %&quot; G_GUINT64_FORMAT
&gt; &quot;-%&quot; G_GUINT64_FORMAT, GST_BUFFER_OFFSET(*buffer),
&gt; GST_BUFFER_OFFSET_END(*buffer));
&gt; -            GST_TRACE_OBJECT(src, &quot;doesHaveEOS: %s, wasSeeking: %s,
&gt; seeking: %s, size: %u&quot;, boolForPrinting(priv-&gt;doesHaveEOS),
&gt; boolForPrinting(priv-&gt;wasSeeking), boolForPrinting(priv-&gt;isSeeking), size);
&gt; +            GST_TRACE_OBJECT(src, &quot;doesHaveEOS: %s, wasSeeking: %s,
&gt; seeking: %s, buffer size: %u, size: %&quot; G_GUINT64_FORMAT,
&gt; boolForPrinting(priv-&gt;doesHaveEOS), boolForPrinting(priv-&gt;wasSeeking),
&gt; boolForPrinting(priv-&gt;isSeeking), size, priv-&gt;size);
&gt;              if (priv-&gt;haveSize &amp;&amp; GST_BUFFER_OFFSET_END(*buffer) &gt;=
&gt; priv-&gt;size) {
&gt;                  if (priv-&gt;wasSeeking)
&gt;                      priv-&gt;wasSeeking = false;
&gt; -                else
&gt; +                else if (priv-&gt;isSeekable)
&gt;                      priv-&gt;doesHaveEOS = true;
&gt;              } else if (priv-&gt;wasSeeking)
&gt;                  priv-&gt;wasSeeking = false;

I tested this patch and it also fixes the issue :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1577368</commentid>
    <comment_count>6</comment_count>
      <attachid>380332</attachid>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-10-07 09:11:03 -0700</bug_when>
    <thetext>Created attachment 380332
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1577369</commentid>
    <comment_count>7</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-10-07 09:12:33 -0700</bug_when>
    <thetext>I haven&apos;t managed to write a reliable test unfortunately.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1578122</commentid>
    <comment_count>8</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-10-09 01:18:00 -0700</bug_when>
    <thetext>Committed r250901: &lt;https://trac.webkit.org/changeset/250901&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1591978</commentid>
    <comment_count>9</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2019-11-20 05:57:30 -0800</bug_when>
    <thetext>This may not have been fixed after all (or we have a different bug).

Here&apos;s a new test case:

   http://tmp.xaq.nl/test-aac.html

Leave it playing normally, and after around 2 minutes of playback you&apos;ll notice some hiccups and it will eventually stop completely.

Reproduced with the MiniBrowser and WebKitGTK 2.26.2

---

In case the URL I pasted earlier changes, the test case contains this single &lt;audio&gt; element:

&lt;audio id=&quot;player&quot; controls&gt;
 &lt;source src=&quot;http://icecast.omroep.nl/radio4-eigentijds-aac&quot; type=&quot;audio/aac&quot; /&gt;
  &lt;p&gt;Your browser does not support the audio element.&lt;/p&gt;
&lt;/audio&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1591981</commentid>
    <comment_count>10</comment_count>
    <who name="Philippe Normand">pnormand</who>
    <bug_when>2019-11-20 06:26:10 -0800</bug_when>
    <thetext>I can&apos;t reproduce this issue in trunk. It happens in Ephy TP though, it&apos;s not related with EOS, so it&apos;s a new bug. Please file it separately and attach logs, as usual with media bugs:

GST_DEBUG_FILE=gst.log GST_DEBUG=&quot;3,webkit*:8&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1591994</commentid>
    <comment_count>11</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2019-11-20 07:33:14 -0800</bug_when>
    <thetext>New bug filed as https://bugs.webkit.org/show_bug.cgi?id=204410</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>380332</attachid>
            <date>2019-10-07 09:11:03 -0700</date>
            <delta_ts>2019-10-08 03:21:56 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-202204-20191007171102.patch</filename>
            <type>text/plain</type>
            <size>2823</size>
            <attacher name="Philippe Normand">pnormand</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjUwNzcyCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggZTg2MmFjZGIyODdlYTlj
YzU2MjUyMjBmMTgwYzczZDgzMTIyMjFhMi4uYzMxYmIxZTY1M2I2Y2JmN2Q2ZDRjNzM5NjIzMDVi
ZGViYmE0MGRhMiAxMDA2NDQKLS0tIGEvU291cmNl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IHByaXYtPndhc1NlZWtpbmcgPSBmYWxz
ZTsKLSAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgZWxzZSBpZiAocHJpdi0+
aXNTZWVrYWJsZSkKICAgICAgICAgICAgICAgICAgICAgcHJpdi0+ZG9lc0hhdmVFT1MgPSB0cnVl
OwogICAgICAgICAgICAgfSBlbHNlIGlmIChwcml2LT53YXNTZWVraW5nKQogICAgICAgICAgICAg
ICAgIHByaXYtPndhc1NlZWtpbmcgPSBmYWxzZTsK
</data>
<flag name="review"
          id="396058"
          type_id="1"
          status="+"
          setter="calvaris"
    />
          </attachment>
      

    </bug>

</bugzilla>