<?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>252782</bug_id>
          
          <creation_ts>2023-02-22 15:17:29 -0800</creation_ts>
          <short_desc>SourceBuffer.timestampOffset usage doesn&apos;t behave correctly with webm content.</short_desc>
          <delta_ts>2023-02-27 14:12:54 -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>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=252886</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=253027</see_also>
          <bug_file_loc>https://jyavenard.github.io/htmltests/tests/mse_webm/vorbis_timestampOffset.html</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>1935990</commentid>
    <comment_count>0</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-02-22 15:17:29 -0800</bug_when>
    <thetext>STR: 
Open https://jyavenard.github.io/htmltests/tests/mse_webm/vorbis_timestampOffset.html

This page load a single webm media segment, then set the sourceBuffer timestampOffset to the SourceBuffer.buffered.end(0) so that we can concatenate all those media segments together in one long chunk.

In Safari we see:
```
36: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
36: Append a media segment.
36: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
36: Append a media segment.
37: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
37: Append a media segment.
37: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
37: Append a media segment.
37: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
37: Append a media segment.
38: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
38: Append a media segment.
41: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
41: Append a media segment.
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.3392199546485262) to TimeRanges: [0, 1.3392199546485262)
```

we can see that the buffered range doesn&apos;t grow.

Firefox and Chrome behave properly:
```
42: SourceBuffer buffered ranges grew from TimeRanges:  to TimeRanges: [0, 1.34)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 1.34) to TimeRanges: [0, 2.68)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 2.68) to TimeRanges: [0, 4.02)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 4.02) to TimeRanges: [0, 5.359999)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 5.359999) to TimeRanges: [0, 6.699999)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 6.699999) to TimeRanges: [0, 8.039999)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 8.039999) to TimeRanges: [0, 9.379999)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 9.379999) to TimeRanges: [0, 10.719999)
42: Append a media segment.
42: got durationchange event
42: SourceBuffer buffered ranges grew from TimeRanges: [0, 10.719999) to TimeRanges: [0, 12.059999)
43: got durationchange event
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1935991</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-02-22 15:17:50 -0800</bug_when>
    <thetext>&lt;rdar://problem/105801920&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1936079</commentid>
    <comment_count>2</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-02-22 23:09:47 -0800</bug_when>
    <thetext>The reason for this is that the libwebmparser enforces checking the size of the WebM Segment parent.
In this particular case the Segment&apos; size is 13705 bytes and the single cluster is 9992 bytes.

When we append a cluster a second time, the overall size becomes larger than the parent Segment could fit and the parser aborts.

Considering a webm is only ever have made of one Segment, and that the matryoshka specification allows for an element size to be unknown and other browsers ignore that size, the simplest way to fix this would be to ignore the Segment&apos;s size.

This would allow to add as many cluster as one wants, regardless of the init segment added.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1936090</commentid>
    <comment_count>3</comment_count>
    <who name="Jean-Yves Avenard [:jya]">jean-yves.avenard</who>
    <bug_when>2023-02-23 00:28:21 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/10565</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1936698</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-02-24 17:10:35 -0800</bug_when>
    <thetext>Committed 260822@main (bee529142266): &lt;https://commits.webkit.org/260822@main&gt;

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

    </bug>

</bugzilla>