[webkit-changes] [WebKit/WebKit] d4723d: [MediaRecorder/WebM] Inefficient memory usage driv...

Jean-Yves Avenard noreply at github.com
Mon Oct 14 16:54:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d4723d6d5ac37964b5a9f8ceb9773f45bdee2b58
      https://github.com/WebKit/WebKit/commit/d4723d6d5ac37964b5a9f8ceb9773f45bdee2b58
  Author: Jean-Yves Avenard <jya at apple.com>
  Date:   2024-10-14 (Mon, 14 Oct 2024)

  Changed paths:
    M Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.h
    M Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.mm

  Log Message:
  -----------
  [MediaRecorder/WebM] Inefficient memory usage driven by libwebm's mkvmuxer
https://bugs.webkit.org/show_bug.cgi?id=281402
rdar://137845423

Reviewed by Youenn Fablet.

mkvmuxer's writes are typically one or two bytes long, which aren't particularly
suited for being stored incrementally into a FragmentedSharedBuffer as each append
requires a new Vector to be created.
Additionally, in a debug build any append to a FragmentedSharedBuffer will cause a consistency check
which becomes very CPU-intensive as it increases in size (profiling shows that over 87% of the web content
time is spent there).
So we write instead to the FragmentedSharedBuffer in block of 1024 bytes, resulting in significant
measured speed and memory gains.

* Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.h:
* Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterWebM.mm:
(WebCore::MediaRecorderPrivateWriterWebM::MediaRecorderPrivateWriterWebM):
(WebCore::MediaRecorderPrivateWriterWebM::appendData):
(WebCore::MediaRecorderPrivateWriterWebM::flushDataBuffer):
(WebCore::MediaRecorderPrivateWriterWebM::takeData):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list