WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
133174
[MSE] Stored samples are not freed when SourceBuffer is removed from MediaSource
https://bugs.webkit.org/show_bug.cgi?id=133174
Summary
[MSE] Stored samples are not freed when SourceBuffer is removed from MediaSource
Jer Noble
Reported
2014-05-22 00:16:17 PDT
[MSE] Stored samples are not freed when SourceBuffer is removed from MediaSource
Attachments
Patch
(11.14 KB, patch)
2014-05-22 00:39 PDT
,
Jer Noble
eric.carlson
: review+
Details
Formatted Diff
Diff
Patch for landing.
(11.37 KB, patch)
2014-05-22 10:49 PDT
,
Jer Noble
no flags
Details
Formatted Diff
Diff
Patch for landing.
(11.40 KB, patch)
2014-05-22 11:07 PDT
,
Jer Noble
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Jer Noble
Comment 1
2014-05-22 00:39:20 PDT
Created
attachment 231866
[details]
Patch
WebKit Commit Bot
Comment 2
2014-05-22 00:41:02 PDT
Attachment 231866
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/mediasource/SampleMap.h:47: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 3
2014-05-22 06:46:49 PDT
Comment on
attachment 231866
[details]
Patch r=me with GTK build and style fixes.
Darin Adler
Comment 4
2014-05-22 08:45:43 PDT
Comment on
attachment 231866
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=231866&action=review
I wanted to set commit-queue+ on this, but I shouldn’t since it will break the GTK build.
> Source/WebCore/Modules/mediasource/SourceBuffer.cpp:279 > + for (auto& trackBufferPair : m_trackBufferMap) { > + trackBufferPair.value.samples.clear(); > + trackBufferPair.value.decodeQueue.clear(); > + }
A better, alternate way to write this is: for (auto& trackBuffer : m_trackBufferMap.values()) { trackBuffer.samples.clear(); trackBuffer.decodeQueue.clear(); }
> Source/WebCore/Modules/mediasource/SourceBuffer.cpp:1441 > + for (auto& trackBufferPair : m_trackBufferMap) > + extraMemoryCost += trackBufferPair.value.samples.sizeInBytes();
A better, alternate way to write this is: for (auto& trackBuffer : m_trackBufferMap.values()) extraMemoryCost += trackBuffer.samples.sizeInBytes();
> Source/WebCore/Modules/mediasource/SourceBuffer.cpp:1446 > + JSC::JSLockHolder lock(scriptExecutionContext()->vm());
Apparently, to get this to compile on GTK, we need to add #include <runtime/JSLock.h> to the top of this file.
> Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:402 > + virtual size_t sizeInBytes() const override { return CMSampleBufferGetTotalSampleSize(m_sample.get()); }
Note that this returns the sample size, not the overhead.
> Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp:53 > + virtual size_t sizeInBytes() const override { return sizeof(m_box); }
And this returns an estimate of the overhead. I don’t think that really makes much sense. But it’s a mock, so I guess no big deal.
Jon Lee
Comment 5
2014-05-22 09:42:09 PDT
<
rdar://problem/16933311
>
Jer Noble
Comment 6
2014-05-22 09:58:04 PDT
Comment on
attachment 231866
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=231866&action=review
>> Source/WebCore/Modules/mediasource/SourceBuffer.cpp:279 >> + } > > A better, alternate way to write this is: > > for (auto& trackBuffer : m_trackBufferMap.values()) { > trackBuffer.samples.clear(); > trackBuffer.decodeQueue.clear(); > }
Yes, that is much better!
>> Source/WebCore/Modules/mediasource/SourceBuffer.cpp:1441 >> + extraMemoryCost += trackBufferPair.value.samples.sizeInBytes(); > > A better, alternate way to write this is: > > for (auto& trackBuffer : m_trackBufferMap.values()) > extraMemoryCost += trackBuffer.samples.sizeInBytes();
DItto.
>> Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:402 >> + virtual size_t sizeInBytes() const override { return CMSampleBufferGetTotalSampleSize(m_sample.get()); } > > Note that this returns the sample size, not the overhead.
Yes, I realize, but as a first-order approximation, it will be largely correct.
>> Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp:53 >> + virtual size_t sizeInBytes() const override { return sizeof(m_box); } > > And this returns an estimate of the overhead. I don’t think that really makes much sense. But it’s a mock, so I guess no big deal.
Well, sort of. The MockSampleBox is effectively "the original sample data", since the data representation is just a serialized MockSampleBox. But I get that CMSampleBuffers may also have the same kind of internal caching of the sample data that I'm not accounting for.
Jer Noble
Comment 7
2014-05-22 10:49:07 PDT
Created
attachment 231895
[details]
Patch for landing.
Jer Noble
Comment 8
2014-05-22 11:07:56 PDT
Created
attachment 231898
[details]
Patch for landing.
Jer Noble
Comment 9
2014-05-22 11:26:16 PDT
Committed
r169209
: <
http://trac.webkit.org/changeset/169209
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug