-
Notifications
You must be signed in to change notification settings - Fork 150
[MSE][GStreamer] update maximum buffer size after receiving first init segment #1534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: wpe-2.46
Are you sure you want to change the base?
[MSE][GStreamer] update maximum buffer size after receiving first init segment #1534
Conversation
I'll have a look at this. |
This change might not be enough, and this call to The logic for maximumSourceBufferSize says that, if there's a previous value, that one should be used instead of the platform supplied value. The initial call is setting that value. While the initial call would ask the platform implementation about the size and return the right size according to the It might make more sense to never call |
@emutavchi, I think I can work on this myself, ensure that my suggestion actually works properly, and directly submit the patch upstream for review, if you don't mind. |
Hi @eocanha, I'm not sure I follow your reasoning here. As far as I can see, WebCore::SourceBuffer::m_maximumBufferSize is set only for testing purposes (from WebCore::Internals::setMaximumSourceBufferSize()). And it is supposed to override any settings/platform configuration. The WebCore::SourceBufferPrivate::setMaximumBufferSize updates WebCore::SourceBufferEvictionData::maximumBufferSize each time it is called with a different value. The point of this PR is to update WebCore::SourceBufferEvictionData::maximumBufferSize when the source buffer receives its first init segment. so it can apply limits correctly. |
β¦t segment Platform can specify different limits depending on the type of the source buffer.
289128c
to
05c7c22
Compare
Ok, I'll run the code, check how the actual values behave, elaborate my reasoning if it makes sense, and submit it upstream for review when I'm sure I understand what happens. |
β¦t segment https://bugs.webkit.org/show_bug.cgi?id=296059 Reviewed by NOBODY (OOPS!). The current SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment() code only calls SourceBufferPrivate::setMaximumBufferSize() on new init segments when the segment has (at least) a video track. Maximum buffer size is managed with high granularity in WPE by using the MSE_MAX_BUFFER_SIZE environment variable. For that reason, that call must happen independently of the kind of tracks present (at least on the WPE platform). This will ensure that the proper frame eviction code in SourceBufferPrivate::setMaximumBufferSize() is called in all cases. See: WebPlatformForEmbedded/WPEWebKit#1534 This patch calls SourceBufferPrivate::setMaximumBufferSize() inconditionally on the WPE platform. Original author: Eugene Mutavchi <[email protected]> * Source/WebCore/Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment): Disable the if, so the call happens inconditionally on WPE.
Added some printfs here to exactly understand what happens (without your patch) and got this, for reference:
That's when I realized that the maximumBufferSize was not cached, as I had initially thought. I think I get it now, sorry: I confused the calls to SourceBuffer::m_private->setMaximumBufferSize() with calls to SourceBuffer::setMaximumBufferSize(). The latter remembers and caches the supplied size, overridding forever the result that SourceBuffer::maximumBufferSize() returns, while the former is basically a call to SourceBufferPrivate::setMaximumBufferSize(), which just triggers immediate eviction when the size is too low. Having that into account, now I really understand the patch and can say it's right. I've submitted it upstream as https://bugs.webkit.org/show_bug.cgi?id=296059 / WebKit/WebKit#48121 Sorry for all the mess. πππ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved (but don't merge. The right commit will be backported from upstream when it lands)
This fixes the configuration of the maximum buffer size of audio source buffers via 'MSE_MAX_BUFFER_SIZE' env variable.
05c7c22