Skip to content

Commit 00a56e0

Browse files
committed
[MSE][GStreamer] Dimension SourceBuffer size limit for all possible track types before init segment received
https://bugs.webkit.org/show_bug.cgi?id=267417 Reviewed by Philippe Normand. SourceBuffer has separate max size limits for video, audio and text, but it has to parse the init segment first to know if there are any video, audio or text tracks. At the very first appendBuffer() there are not tracks parsed yet, so platformMaximumBufferSize() returns 0 (as no tracks are there), and the limit is taken from MediaElementSession as audio limit 15MB as no video track is present. See: #1261 Inspired by the work of Andrzej Surdej <Andrzej_Surdej@comcast.com>. This patch adjusts the platform limits for WPE so that they account for the possibility of any (or even all) of the possible track types appearing when processing the init segment. * Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp: (WebCore::SourceBufferPrivateGStreamer::platformMaximumBufferSize const): Accumulate all the audio, video, text maximum sizes when no tracks have been detected yet. Canonical link: https://commits.webkit.org/273039@main
1 parent da14ef5 commit 00a56e0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ size_t SourceBufferPrivateGStreamer::platformMaximumBufferSize() const
331331
});
332332

333333
// If any track type size isn't specified, we consider that it has no limit and the values from the
334-
// element have to be used. Otherwise, the track limits are accumulative.
334+
// element have to be used. Otherwise, the track limits are accumulative. If everything is specified
335+
// but there's no track (eg: because we're processing an init segment that we don't know yet which
336+
// kind of track(s) is going to generate) we assume that the 3 kind of tracks might appear (audio,
337+
// video, text) and use all the accumulated limits at once to make room for any possible outcome.
335338
do {
336339
bool hasVideo = false;
337340
bool hasAudio = false;
@@ -354,19 +357,19 @@ size_t SourceBufferPrivateGStreamer::platformMaximumBufferSize() const
354357
}
355358
}
356359

357-
if (hasVideo) {
360+
if (hasVideo || m_tracks.isEmpty()) {
358361
if (maxBufferSizeVideo)
359362
bufferSize += maxBufferSizeVideo;
360363
else
361364
break;
362365
}
363-
if (hasAudio) {
366+
if (hasAudio || m_tracks.isEmpty()) {
364367
if (maxBufferSizeAudio)
365368
bufferSize += maxBufferSizeAudio;
366369
else
367370
break;
368371
}
369-
if (hasText) {
372+
if (hasText || m_tracks.isEmpty()) {
370373
if (maxBufferSizeText)
371374
bufferSize += maxBufferSizeText;
372375
else

0 commit comments

Comments
 (0)