[webkit-changes] [WebKit/WebKit] 1581c8: [MSE] Skip initial buffering rate computation

Enrique Ocaña González noreply at github.com
Tue Mar 7 09:16:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1581c8aa2d3c0f9613a9d1bd881929ead44a4ea2
      https://github.com/WebKit/WebKit/commit/1581c8aa2d3c0f9613a9d1bd881929ead44a4ea2
  Author: Enrique Ocaña González <eocanha at igalia.com>
  Date:   2023-03-07 (Tue, 07 Mar 2023)

  Changed paths:
    M Source/WebCore/Modules/mediasource/SourceBuffer.cpp

  Log Message:
  -----------
  [MSE] Skip initial buffering rate computation
https://bugs.webkit.org/show_bug.cgi?id=253074

Reviewed by Jer Noble.

m_timeOfBufferingMonitor is initialized in SourceBuffer at creation
time. If the first call to monitorBufferingRate() takes too much to
happen for whatever reason (eg: because the webpage takes too much to
perform the first append), the computed interval is already going to be
too big and generate an artificially low m_averageBufferRate.

To mitigate this, I've added code to initialize m_timeOfBufferingMonitor
to zero, detect that special value in monitorBufferingRate() and skip
the first time that the rate computation is done (just assigning the
"now" time to m_timeOfBufferingMonitor, so when the next update is done,
the interval is most realistic).

However, since monitorBufferingRate() calls are only done from
canPlayThroughRange() and that call might happen only once in some
layout tests and production scenarios, m_averageBufferRate might not
reach accurate values on time and make the test fail. To mitigate that,
I've also added extra calls every time a buffer is appended and every
time the append completes.

See: https://github.com/WebPlatformForEmbedded/WPEWebKit/issues/928#issuecomment-1327746356

* Source/WebCore/Modules/mediasource/SourceBuffer.cpp: Initialize m_timeOfBufferingMonitor to zero, meaning "never updated before".
(WebCore::SourceBuffer::appendBuffer): Update monitorBufferingRate.
(WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): UpdateMonitorBufferingRate.
(WebCore::SourceBuffer::monitorBufferingRate): Skip first m_averageBufferRate update.

Canonical link: https://commits.webkit.org/261328@main




More information about the webkit-changes mailing list