Skip to content

Commit

Permalink
[MSE] Reset extra memory cost inside removedFromMediaSource()
Browse files Browse the repository at this point in the history
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: WebPlatformForEmbedded#1264

This patch resets m_extraMemoryCost when the SourceBuffer is removed.

Original author: Andrzej Surdej <[email protected]>

* Source/WebCore/Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::removedFromMediaSource): Reset m_extraMemoryCost.

Canonical link: https://commits.webkit.org/272908@main
  • Loading branch information
eocanha committed Jan 11, 2024
1 parent d7dbe70 commit da14ef5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit da14ef5

Please sign in to comment.