From da14ef5ef780fa74de1d5b5679d1cfb0ce692f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= Date: Thu, 11 Jan 2024 02:10:20 -0800 Subject: [PATCH] [MSE] Reset extra memory cost inside removedFromMediaSource() https://bugs.webkit.org/show_bug.cgi?id=267350 Reviewed by Xabier Rodriguez-Calvar. When the SourceBuffer is removed from a MediaSource, its TrackBuffers are cleared (and so is its data, which can take a good amount of memory), but the SourceBuffer still accounts for the cost of its old data, as m_extraMemoryCost isn't reset to zero. See: https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/1264 This patch resets m_extraMemoryCost when the SourceBuffer is removed. Original author: Andrzej Surdej * Source/WebCore/Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::removedFromMediaSource): Reset m_extraMemoryCost. Canonical link: https://commits.webkit.org/272908@main --- Source/WebCore/Modules/mediasource/SourceBuffer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp index 685940723e7c7..e9e4437132973 100644 --- a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp +++ b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp @@ -447,6 +447,7 @@ void SourceBuffer::removedFromMediaSource() m_private->removedFromMediaSource(); m_private->setIsAttached(false); m_source = nullptr; + m_extraMemoryCost = 0; } void SourceBuffer::seekToTime(const MediaTime& time)