<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [MSE] Incorrect sample timestamps when using &quot;sequence&quot; mode"
   href="https://bugs.webkit.org/show_bug.cgi?id=147252">147252</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[MSE] Incorrect sample timestamps when using &quot;sequence&quot; mode
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>URL</th>
          <td>https://googlesamples.github.io/web-fundamentals/samples/updates/mse-gap.html
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Mac OS X 10.10
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Media Elements
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sajidanwar94&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jer.noble&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is my first WebKit bug and (hopefully) future patch so pardon any mistakes in the contribution process!

There are two problems that I've seen in the SourceBuffer implementation when it is in sequence mode:

1. In the coded frame processing algorithm, step 1.3, the condition should be checking if the source buffer's mode is &quot;sequence&quot; and if the group start timestamp is valid. The condition currently looks like this:

    if (m_mode == sequenceKeyword())

2. According to the specification, &quot;sequence&quot; mode indicates that &quot;[m]edia segments will be treated as adjacent in time independent of the timestamps in the media segment&quot; [1]. In the current implementation of the coded frame processing algorithm, the timestamp offset (when it is non-zero) is being added to each sample's presentation timestamp and decode timestamp, regardless of the append mode. For the audio MIME types &quot;audio/mpeg&quot; and &quot;audio/aac&quot;, the specification says that the generate timestamps flag should be set [2], and therefore the mode will be &quot;sequence&quot;. I've found that in some cases (such as in the URL provided in this report), the samples of the audio already have the correct presentation timestamps. Consequently, when the generated timestamp offsets are being added to each sample, the effect is that each sample's presentation timestamp is doubled and the audio plays incorrectly, and sometimes not at all. For &quot;seque

I have a patch to address these that I will attach shortly.

[1]: <a href="https://w3c.github.io/media-source/#idl-def-AppendMode.sequence">https://w3c.github.io/media-source/#idl-def-AppendMode.sequence</a>
[2]: <a href="https://w3c.github.io/media-source/byte-stream-format-registry.html">https://w3c.github.io/media-source/byte-stream-format-registry.html</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>